From 9348fc5e158454c02f70f9aa2fc149be71d2f6e6 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Thu, 14 Jan 2021 17:09:22 +0100 Subject: [PATCH] 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. --- .github/actions/build-nominatim/action.yml | 4 ++-- .github/workflows/ci-tests.yml | 2 +- cmake/script.tmpl | 4 ++++ lib/dotenv_loader.php | 13 +++++++++++++ lib/lib.php | 9 --------- 5 files changed, 20 insertions(+), 12 deletions(-) create mode 100644 lib/dotenv_loader.php diff --git a/.github/actions/build-nominatim/action.yml b/.github/actions/build-nominatim/action.yml index e6aec814..3cd826af 100644 --- a/.github/actions/build-nominatim/action.yml +++ b/.github/actions/build-nominatim/action.yml @@ -6,7 +6,7 @@ runs: steps: - name: Install prerequisits run: | - sudo apt-get install -y -qq libboost-system-dev libboost-filesystem-dev libexpat1-dev zlib1g-dev libbz2-dev libpq-dev libproj-dev python3-psycopg2 python3-pyosmium php-symfony-dotenv python3-dotenv + sudo apt-get install -y -qq libboost-system-dev libboost-filesystem-dev libexpat1-dev zlib1g-dev libbz2-dev libpq-dev libproj-dev python3-psycopg2 python3-pyosmium python3-dotenv shell: bash - name: Configure @@ -16,7 +16,7 @@ runs: - name: Build run: | make -j2 all - ./utils/setup.php --setup-website + ./nominatim refresh --website shell: bash working-directory: build diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index d462a8bb..8dd19aa4 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -47,7 +47,7 @@ jobs: - name: Install test prerequsites run: | - sudo apt-get install -y -qq php-codesniffer python3-tidylib + sudo apt-get install -y -qq php-codesniffer python3-tidylib php-symfony-dotenv sudo pip3 install behave - name: PHP linting diff --git a/cmake/script.tmpl b/cmake/script.tmpl index b0e1f535..30b8717b 100755 --- a/cmake/script.tmpl +++ b/cmake/script.tmpl @@ -1,8 +1,12 @@ #!@PHP_BIN@ -Cq load(CONST_DataDir.'/settings/env.defaults'); + + if (file_exists('.env')) { + $dotenv->load('.env'); + } +} diff --git a/lib/lib.php b/lib/lib.php index 5e89916c..7760f695 100644 --- a/lib/lib.php +++ b/lib/lib.php @@ -1,7 +1,5 @@ load(CONST_DataDir.'/settings/env.defaults'); - - if (file_exists($sProjectDir.'/.env')) { - $dotenv->load($sProjectDir.'/.env'); - } } function getSetting($sConfName, $sDefault = null) -- 2.39.5