diff --git a/composer.json b/composer.json index 56389b9f..829bb949 100644 --- a/composer.json +++ b/composer.json @@ -41,7 +41,10 @@ "Shlinkio\\Shlink\\Rest\\": "module/Rest/src", "Shlinkio\\Shlink\\Core\\": "module/Core/src", "Shlinkio\\Shlink\\Common\\": "module/Common/src" - } + }, + "files": [ + "module/Common/functions/functions.php" + ] }, "autoload-dev": { "psr-4": { diff --git a/config/autoload/database.global.php b/config/autoload/database.global.php index 62733f22..4d05ea36 100644 --- a/config/autoload/database.global.php +++ b/config/autoload/database.global.php @@ -3,9 +3,9 @@ return [ 'database' => [ 'driver' => 'pdo_mysql', - 'user' => getenv('DB_USER'), - 'password' => getenv('DB_PASSWORD'), - 'dbname' => getenv('DB_NAME') ?: 'shlink', + 'user' => env('DB_USER'), + 'password' => env('DB_PASSWORD'), + 'dbname' => env('DB_NAME', 'shlink'), 'charset' => 'utf8', 'driverOptions' => [ PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8' diff --git a/config/autoload/translator.global.php b/config/autoload/translator.global.php index e3730927..d0561cbe 100644 --- a/config/autoload/translator.global.php +++ b/config/autoload/translator.global.php @@ -2,7 +2,7 @@ return [ 'translator' => [ - 'locale' => getenv('DEFAULT_LOCALE') ?: 'en', + 'locale' => env('DEFAULT_LOCALE', 'en'), ], ]; diff --git a/config/autoload/url-shortener.global.php b/config/autoload/url-shortener.global.php index 718ed3f0..5b0d95c9 100644 --- a/config/autoload/url-shortener.global.php +++ b/config/autoload/url-shortener.global.php @@ -1,12 +1,14 @@ [ 'domain' => [ - 'schema' => getenv('SHORTENED_URL_SCHEMA') ?: 'http', - 'hostname' => getenv('SHORTENED_URL_HOSTNAME'), + 'schema' => env('SHORTENED_URL_SCHEMA', 'http'), + 'hostname' => env('SHORTENED_URL_HOSTNAME'), ], - 'shortcode_chars' => getenv('SHORTCODE_CHARS'), + 'shortcode_chars' => env('SHORTCODE_CHARS', UrlShortener::DEFAULT_CHARS), ], ]; diff --git a/module/Common/functions/functions.php b/module/Common/functions/functions.php new file mode 100644 index 00000000..f0f86f77 --- /dev/null +++ b/module/Common/functions/functions.php @@ -0,0 +1,36 @@ + [ - 'username' => getenv('REST_USER'), - 'password' => getenv('REST_PASSWORD'), + 'username' => env('REST_USER'), + 'password' => env('REST_PASSWORD'), ], ];