All ActiveWAFL applications have environment specific configurations that are stored in a Syrup file named "Config/Settings.<environment>.syrp".
By default, this file is populated with the basic required settings for an application.
If you want to add custom settings, you may add them to any section in the Syrup file.
You can then access these settings in your application by using the
Setup a Custom Option
- GuestGroupId = 99
- Foo = Bar
- DomainName = "d.myapp.com"
- WebUrl = "http://d.myapp.com/"
- WebUrlSecure = "https://d.myapp.com/"
- and so on....
Get the Value of a Custom Option
- namespace MyApp\Controllers;
- class MyController
- extends \DblEj\Mvc\ControllerBase
- public function DefaultAction(\DblEj\Communication\Http\Request $request, \DblEj\Application\IMvcWebApplication $app)
- //read the value of the Foo setting from the settings file
- $foo = app->GetSettingsSection("Application")->GetOptionValue("Foo");
- //add the value of the Foo setting to a Model that can be used during view rendering
- $viewModel = new \DblEj\Data\ArrayModel(["FOO"=>$foo]);
- //pass the Model, which contains the value for the Foo setting, to be used by the view rendering engine and return the rendered view
- return $this->createResponseFromRequest($request, $app, $viewModel);
Using the Settings.<environment> file provides a quick and easy way to store environment specific settings and the corresponding methods provide a simple and standard way of reading those settings.
You can add your custom settings to any section of the settings file, or you may create new custom sections to put them under.
Note: The application provides several methods for directly accessing a section in the settings file.
$app->Get_Settings()->Get_Web() is the same as