- Backer | 1
This is how I configure app with environment vars:
parameters: db: dsn: ::getenv('APP_DB_DSN') user: ::getenv('APP_DB_USER') ... database: default: dsn: %db.dsn% user: %db.user% ...
Since new schema validation I am getting
The option 'database › default › dsn' expects to be string or Nette\Schema\DynamicParameter, object Nette\DI\Definitions\Statement given.
Any ideas how to solve this use case?
Last edited by prog (2019-04-10 12:41)
I checked the contributte “ExtraConfigurator”… It does not solve my case, because prefixing ENV vars is not an option (on servers, renaming them would be a BC break for older projects and duplicationg would bring maintenance hell).
Similarly, I could write a tool that would load variables in similar manner or create DynamicParameters out of desired ENV vars, but this is still sub optimal for something as simple as this.
I'm guessing that something like the following would not work either, would it?
<?php // neon parameters: system: proxy: @envWrapper::getEnvAsDynamicParameter(TRUSTED_PROXIES) http: proxy: %system.proxy% ?>