Verified Commit 5e11fba2 authored by Artemis's avatar Artemis 🐱

Added dotenv

parent 2cb30450
......@@ -15,3 +15,4 @@ node_modules/
.vscode/
*.log
vendor
.env
......@@ -18,7 +18,8 @@
"symfony/console": "^5.0",
"matthiasmullie/minify": "^1.3",
"scrivo/highlight.php": "v9.18.1.1",
"ext-readline": "*"
"ext-readline": "*",
"vlucas/phpdotenv": "^4.1"
},
"license": "Apache-2.0",
"authors": [
......
......@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "7a8f8aa87d73832b67eeb186bacbc555",
"content-hash": "ea9a34e95983aa090954b474c98f56e6",
"packages": [
{
"name": "cakephp/collection",
......@@ -910,6 +910,61 @@
],
"time": "2019-09-26T11:24:58+00:00"
},
{
"name": "phpoption/phpoption",
"version": "1.7.3",
"source": {
"type": "git",
"url": "https://github.com/schmittjoh/php-option.git",
"reference": "4acfd6a4b33a509d8c88f50e5222f734b6aeebae"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/schmittjoh/php-option/zipball/4acfd6a4b33a509d8c88f50e5222f734b6aeebae",
"reference": "4acfd6a4b33a509d8c88f50e5222f734b6aeebae",
"shasum": ""
},
"require": {
"php": "^5.5.9 || ^7.0 || ^8.0"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.3",
"phpunit/phpunit": "^4.8.35 || ^5.0 || ^6.0 || ^7.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.7-dev"
}
},
"autoload": {
"psr-4": {
"PhpOption\\": "src/PhpOption/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Johannes M. Schmitt",
"email": "[email protected]"
},
{
"name": "Graham Campbell",
"email": "[email protected]"
}
],
"description": "Option Type for PHP",
"keywords": [
"language",
"option",
"php",
"type"
],
"time": "2020-03-21T18:07:53+00:00"
},
{
"name": "psr/container",
"version": "1.0.0",
......@@ -1905,6 +1960,70 @@
"templating"
],
"time": "2020-02-11T15:33:47+00:00"
},
{
"name": "vlucas/phpdotenv",
"version": "v4.1.5",
"source": {
"type": "git",
"url": "https://github.com/vlucas/phpdotenv.git",
"reference": "539bb6927c101a5605d31d11a2d17185a2ce2bf1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/539bb6927c101a5605d31d11a2d17185a2ce2bf1",
"reference": "539bb6927c101a5605d31d11a2d17185a2ce2bf1",
"shasum": ""
},
"require": {
"php": "^5.5.9 || ^7.0 || ^8.0",
"phpoption/phpoption": "^1.7.2",
"symfony/polyfill-ctype": "^1.9"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.3",
"ext-filter": "*",
"ext-pcre": "*",
"phpunit/phpunit": "^4.8.35 || ^5.0 || ^6.0 || ^7.0"
},
"suggest": {
"ext-filter": "Required to use the boolean validator.",
"ext-pcre": "Required to use most of the library."
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.1-dev"
}
},
"autoload": {
"psr-4": {
"Dotenv\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Graham Campbell",
"email": "[email protected]",
"homepage": "https://gjcampbell.co.uk/"
},
{
"name": "Vance Lucas",
"email": "[email protected]",
"homepage": "https://vancelucas.com/"
}
],
"description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.",
"keywords": [
"dotenv",
"env",
"environment"
],
"time": "2020-05-02T14:08:57+00:00"
}
],
"packages-dev": [],
......@@ -1916,7 +2035,8 @@
"platform": {
"ext-fileinfo": "*",
"ext-mbstring": "*",
"ext-pdo": "*"
"ext-pdo": "*",
"ext-readline": "*"
},
"platform-dev": []
}
......@@ -12,6 +12,10 @@ function try_read_hash(string $hash_file): ?string
return file_get_contents($path);
}
if (file_exists(__DIR__ . '/.env')) {
(Dotenv\Dotenv::createImmutable(__DIR__))->load();
}
return [
'auth_token' => getenv('AUTH_TOKEN'),
'db' => getenv('DB_DSN'),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment