From 1ff199e81f5b7d20145670a85529c833cbb9ed54 Mon Sep 17 00:00:00 2001 From: Robin Wood Date: Tue, 16 Jan 2024 19:58:26 +0000 Subject: [PATCH] Revert "feat: allow configuration via environment variables" --- README.md | 12 ------------ compose.yml | 2 +- config/config.inc.php.dist | 22 +++++++++++----------- 3 files changed, 12 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 23fd0c38c..e1faed020 100644 --- a/README.md +++ b/README.md @@ -173,18 +173,6 @@ On Windows, this can be a bit harder if you are hiding file extensions, if you a [How to Make Windows Show File Extensions](https://www.howtogeek.com/205086/beginner-how-to-make-windows-show-file-extensions/) -### Config with Environment variables - -Instead of modifing the config file you can also set most of the settings using environment variables. In a docker setup this allows to change the configuration without creating a new docker image. You can find the variables in the `config/config.inc.php.dist` file. - -If you want to set the default security level to "low", just add the line to the docker-compose.yml: - -```yml -environment: - - DB_SERVER=db - - DEFAULT_SECURITY_LEVEL=low -``` - ### Database Setup To set up the database, simply click on the `Setup DVWA` button in the main menu, then click on the `Create / Reset Database` button. This will create / reset the database for you with some data in. diff --git a/compose.yml b/compose.yml index 3ea9f6fce..e12f10aa4 100644 --- a/compose.yml +++ b/compose.yml @@ -13,7 +13,7 @@ services: # Change `always` to `build` to build from local source pull_policy: always environment: - - DVWA_DB_SERVER=db + - DB_SERVER=db depends_on: - db networks: diff --git a/config/config.inc.php.dist b/config/config.inc.php.dist index e3c2ae68f..7c6e2c3f2 100644 --- a/config/config.inc.php.dist +++ b/config/config.inc.php.dist @@ -5,7 +5,7 @@ # Thanks to @digininja for the fix. # Database management system to use -$DBMS = getenv('DVWA_DBMS') ?: 'MySQL'; +$DBMS = 'MySQL'; #$DBMS = 'PGSQL'; // Currently disabled # Database variables @@ -15,32 +15,32 @@ $DBMS = getenv('DVWA_DBMS') ?: 'MySQL'; # If you are using MariaDB then you cannot use root, you must use create a dedicated DVWA user. # See README.md for more information on this. $_DVWA = array(); -$_DVWA[ 'db_server' ] = getenv('DVWA_DB_SERVER') ?: '127.0.0.1'; -$_DVWA[ 'db_database' ] = getenv('DVWA_DB_DATABASE') ?: 'dvwa'; -$_DVWA[ 'db_user' ] = getenv('DVWA_DB_USER') ?: 'dvwa'; -$_DVWA[ 'db_password' ] = getenv('DVWA_DB_PASSWORD') ?: 'p@ssw0rd'; -$_DVWA[ 'db_port'] = getenv('DVWA_DB_PORT') ?: '3306'; +$_DVWA[ 'db_server' ] = getenv('DB_SERVER') ?: '127.0.0.1'; +$_DVWA[ 'db_database' ] = 'dvwa'; +$_DVWA[ 'db_user' ] = 'dvwa'; +$_DVWA[ 'db_password' ] = 'p@ssw0rd'; +$_DVWA[ 'db_port'] = '3306'; # ReCAPTCHA settings # Used for the 'Insecure CAPTCHA' module # You'll need to generate your own keys at: https://www.google.com/recaptcha/admin -$_DVWA[ 'recaptcha_public_key' ] = getenv('DVWA_RECAPTCHA_PUBLIC_KEY') ?: ''; -$_DVWA[ 'recaptcha_private_key' ] = getenv('DVWA_RECAPTCHA_PRIVATE_KEY') ?: ''; +$_DVWA[ 'recaptcha_public_key' ] = ''; +$_DVWA[ 'recaptcha_private_key' ] = ''; # Default security level # Default value for the security level with each session. # The default is 'impossible'. You may wish to set this to either 'low', 'medium', 'high' or impossible'. -$_DVWA[ 'default_security_level' ] = getenv('DVWA_DEFAULT_SECURITY_LEVEL') ?: 'impossible'; +$_DVWA[ 'default_security_level' ] = 'impossible'; # Default locale # Default locale for the help page shown with each session. # The default is 'en'. You may wish to set this to either 'en' or 'zh'. -$_DVWA[ 'default_locale' ] = getenv('DVWA_DEFAULT_LOCALE') ?: 'en'; +$_DVWA[ 'default_locale' ] = 'en'; # Disable authentication # Some tools don't like working with authentication and passing cookies around # so this setting lets you turn off authentication. -$_DVWA[ 'disable_authentication' ] = getenv('DVWA_DISABLE_AUTHENTICATION') ?: false; +$_DVWA[ 'disable_authentication' ] = false; define ('MYSQL', 'mysql'); define ('SQLITE', 'sqlite');