Sarah Hoffmann [Thu, 14 Jan 2021 16:09:22 +0000 (17:09 +0100)]
move dotenv parsing to installed PHP scripts
This means that the php-symfony-dotenv library is now only needed
when using the legacy scripts. This includes the BDD tests which
currently still rely on the PHP utils.
Sarah Hoffmann [Thu, 14 Jan 2021 08:30:23 +0000 (09:30 +0100)]
avoid accessing constants when getting data from env
When a setting can be read from the environment variable, avoid
accessing the internal defaults. This way the scripts can be
accessed directly in \lib as long as the environment is set up
correctly with full defaults.
Sarah Hoffmann [Wed, 13 Jan 2021 17:25:15 +0000 (18:25 +0100)]
implement warming in new cli tool
Adds infrastructure for calling the legacy PHP scripts. As the
CONST_* values cannot be set from the python script, hand the values
in via secret environment variables instead. These are all
temporary hacks for the transition phase to python code.
Sarah Hoffmann [Thu, 7 Jan 2021 10:51:38 +0000 (11:51 +0100)]
bdd: import API test DB as part of step setup
In the future, the BDD tests will simply set up the required
test database themselves. Like with the template database, it
is not reimported when it already exists unless that is explicitly
forced.
Makes most of the API tests currently fail because they still
point to old test data.
Sarah Hoffmann [Wed, 6 Jan 2021 11:28:09 +0000 (12:28 +0100)]
bdd: move column comparison in separate file
Introduces a new class DBRow that encapsulates the comparison
functions. This also is responsible for formatting more informative
assert messages. place and placex steps are unified.
Sarah Hoffmann [Tue, 5 Jan 2021 10:22:43 +0000 (11:22 +0100)]
bdd: switch to auto commit mode
Put the connection to the test database into auto-commit mode
and get rid of the explicit commits. Also use cursors always in
context managers and unify the two implementations that copy
data from the place table.
Sarah Hoffmann [Mon, 4 Jan 2021 10:39:45 +0000 (11:39 +0100)]
create a temporary project dir for tests
The project directory contains the website script as
configured through the test configuration. This means
that tests are now completely independet of any
configuration that may be contained in the build
directory.
Also removes the hack to inject additional settings via
a environment variable.
Sarah Hoffmann [Thu, 17 Dec 2020 13:58:09 +0000 (14:58 +0100)]
move creation of website scripts to setup script
Instead of creating the website wrapper scripts with cmake,
they are now created when --setup-website is called. The
setup of the configuration constants is directly embedded
into the scripts. This means we can get rid of the separate
settings-frontend.php. More importantly however, it means
that it is now possible to set up multiple website directories
from the same build directory.
Sarah Hoffmann [Thu, 17 Dec 2020 10:46:01 +0000 (11:46 +0100)]
adapt tests to new dotenv environment
DB tests now can simply set the environment to change configuration
variables. API tests still rely on a configuration file.
Also, query.php needs to set up the CONST_* variables to work with
the query scripts. That is a tiny bit messy and duplicates code
but this part will need to be reworked later.
Sarah Hoffmann [Tue, 15 Dec 2020 14:12:28 +0000 (15:12 +0100)]
replace database settings with dotenv variant
As we can't refer to the project root dir in the module path, the
module path may now also be a relative directory which is then
taken as being relative to the project root path.
Moves the checkModulePresence() function into the Setup class, so
that it can work on the computed absolute module path.
Sarah Hoffmann [Tue, 15 Dec 2020 12:57:34 +0000 (13:57 +0100)]
introduce dotenv parsing for setup.php
This adds the notion of a project directory. This is the directory
that holds all necessary files for one specific installation of
Nominatim. Dotenv looks for an .env file in this directory and
adds it to the global environment together with the defaults from
Nominatim's data directory.
Add's symfony's dotenv library as a new dependency.
Sarah Hoffmann [Tue, 15 Dec 2020 10:04:19 +0000 (11:04 +0100)]
make HTTP proxy setup explicit
The setup relies on the project configuration which we want to
explicitly set up in later steps. Therefore proxy setup needs to
be done explicitly as well. There is the added bonus that the
setup is done only for the utils which try to call outside.
Sarah Hoffmann [Tue, 15 Dec 2020 09:09:55 +0000 (10:09 +0100)]
reorganise path settings in config
CONST_BasePath is split into separate configuration variables
for binaries, libraries and data. These variables as well as
the installation path are now set in the executable directly and
no longer configurable via project settings.
This is the first step towards an installable software. The
executables should know per installation where to find their
necessary data to execute. Project configuration needs to be
restricted to settings that really concern the specific Nominatim
installation.