diff --git a/.gitignore b/.gitignore index 94385d4..0102aa5 100644 --- a/.gitignore +++ b/.gitignore @@ -49,4 +49,4 @@ Thumbs.db *.db *.sqlite *.zip - +/src/config.php diff --git a/angular.json b/angular.json index 6cd5ddf..cc06d89 100644 --- a/angular.json +++ b/angular.json @@ -24,6 +24,11 @@ "input": "src/api", "output": "/api" }, + { + "glob": "config*.php", + "input": "src", + "output": "/" + }, { "glob": "*.json", "input": "src/json", diff --git a/src/api/index.php b/src/api/index.php index 51d888e..11816a5 100644 --- a/src/api/index.php +++ b/src/api/index.php @@ -11,7 +11,13 @@ use RedBeanPHP\R; require './vendor/autoload.php'; -R::setup('sqlite:taskboard.sqlite'); +$CONFIG = require('../config.default.php'); +if (file_exists('../config.php')) { + $CONFIG = array_merge($CONFIG, require('../config.php')); +} + + +R::setup($CONFIG['database'], $CONFIG['database_user'], $CONFIG['database_password']); $container = new DI\Container(); AppFactory::setContainer($container); diff --git a/src/config.default.php b/src/config.default.php new file mode 100644 index 0000000..1405579 --- /dev/null +++ b/src/config.default.php @@ -0,0 +1,23 @@ + 'sqlite:taskboard.sqlite', +'database_user' => '', +'database_password' => '', + + +);