From 73c257347933fa5a65acc7a9e40b79a9b6e020ca Mon Sep 17 00:00:00 2001 From: Chemaclass Date: Fri, 9 Jul 2021 22:28:01 +0200 Subject: [PATCH] Update config doc --- README.md | 12 ++++++------ docs/004_config.md | 42 ++++++++++++++++++++++++++++++++++++------ 2 files changed, 42 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index a170ecb1..bba10d77 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ ## Gacela Framework -This framework helps you to improve the design of your modules. +Gacela is a class resolver. It helps you to improve the design of your modules. > Inspired by Spryker Framework: https://github.com/spryker @@ -32,11 +32,11 @@ Splitting your project into different modules will help the design of your proje scalability. It will certainly encourage your modules to interact with each other in a unified way by following these rules: -- Different modules can interact **ONLY** via their `Facade` -- The `Facade` has access to the `Factory` -- The `Factory` creates the objects from the module and has access to the Module's `Config` -- The `Config` gets the values from your defined config files -- The `DependencyProvider` uses the Locator to get the Facades from different modules +- Different modules can interact **only** via their `Facade`. +- The `Facade` has access to the `Factory`. +- The `Factory` creates the objects from the module and has access to the Module's `Config`. +- The `Config` gets the values from your defined config files. +- The `DependencyProvider` uses the Locator to get the Facades from different modules. ### Installation diff --git a/docs/004_config.md b/docs/004_config.md index b7ae8399..4225e335 100644 --- a/docs/004_config.md +++ b/docs/004_config.md @@ -28,17 +28,36 @@ Using `.env` config files: "config": { "type": "env", "path": ".env*", - "path_local": ".env.local.dist" + "path_local": ".env.local" } } ``` -- `type`: enum with possible values `php` or `env` -- `path`: this is the path of the folder which contains your application configuration. - You can use `?` or `*` in order to match 1 or multiple characters. Check [`glob()`](https://www.php.net/manual/en/function.glob.php) function for more info. -- `path_local`: this is the last file loaded, which means, it will override the previous configuration, - so you can easily add it to your `.gitignore` and set your local config values in case you want to have something different for some cases +Or even multiple types of config files: +```json +{ + "config": [ + { + "type": "php", + "path": "config/*.php", + "path_local": "config/local.php" + }, + { + "type": "env", + "path": ".env*", + "path_local": ".env.local" + } + ] +} +``` + +- `"type"`: possible values `php` or `env` +- `"path"`: the path of the folder which contains your application configuration. + You can use `?` or `*` in order to match 1 or multiple characters. + Check [`glob()`](https://www.php.net/manual/en/function.glob.php) function for more info. +- `"path_local"`: this is the last file loaded, which means, it will override the previous configuration, + so you can add it to your `.gitignore` and set your own local config values. --- > This is tightly coupled with the infrastructure layer, because there is I/O involved. @@ -48,6 +67,17 @@ Using `.env` config files: ### An example +```json +# gacela.json +{ + "config": { + "type": "php", + "path": "config/*.php", + "path_local": "config/local.php" + } +} +``` + ```php # config/default.php use src\Calculator\Config;