You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Change the use of term namespace to use env so variable names like NAMESPACE_FOR_DYNACONF will be changed to ENV_FOR_DYNACONF, also functions like using_namespace will be called using_env and a compat layer must be added to not break. The reason is that it meets the use of ENV in other frameworks.
Rename the base DYNACONF env to DEFAULT, currently, the base env is called DYNACONF it is the default namespace for variables and must be renamed to DEFAULT (this will be a breaking change)
Change the order of loading setting .toml as the preferred config format.
Add to CLICli tool #2 a command called init which will add a new settings.* file (defautls to toml) containing the scaffolding.
So with this change, an application config file will look like this.
settings.toml
[default]
server = 'defaulserver.com'# value in [default] env will serve as default when it is not defined in specific env# default is optional and can also be empty or ommited# values from other [envs] will overrride existing default values
[development]
server = 'devserver.com'
[staging]
server = 'stagingserver.com'user = 'staging user'
[testing]
server = 'ciserver.com'
[production]
server = 'prodserver.com'
[custom]
server = 'customserver.com'# If it is needed to override all values in every namespace declare a [global] env
[global]
server = 'itoverrideseverything.com'
IN a .secrets file there is no reason to have different envs as easch environment must have its own secrets file. .secrets.toml
[default]
password = 'SuperSecret'
The variable ENV_FOR_DYNACONF must default to DEVELOPMENT and when it is time to change a variable must be defined.
export ENV_FOR_DYNACONF=PRODUCTION
That is all
Programatically switching namespaces may be useful for testing and also to use Dynaconf as a Feature flag system so to switch:
withsettings.using_env('staging'):
assertsettings.USERNAME=='staging user'assertsettings.SERVER==itoverrideseverything.com' # override by [global]
The higher precedence is always for the DYNACONF env it works as a global and is named DYNACONF instead of GLOBAl to avoid conflicts with existing envvars.
rochacbruno
changed the title
RFC: Change the BASE_NAMESPACE from DYNACONF to GLOBAL
RFC: Change the BASE_NAMESPACE from DYNACONF to DEFAULMay 22, 2018
rochacbruno
changed the title
RFC: Change the BASE_NAMESPACE from DYNACONF to DEFAUL
RFC: Change the BASE_NAMESPACE from DYNACONF to DEFAULTMay 22, 2018
Change the use of term
namespace
to useenv
so variable names likeNAMESPACE_FOR_DYNACONF
will be changed toENV_FOR_DYNACONF
, also functions likeusing_namespace
will be calledusing_env
and a compat layer must be added to not break. The reason is that it meets the use ofENV
in other frameworks.Rename the base
DYNACONF
env toDEFAULT
, currently, the baseenv
is calledDYNACONF
it is the default namespace for variables and must be renamed toDEFAULT
(this will be a breaking change)Change the order of loading setting
.toml
as the preferred config format.Add to
CLI
Cli tool #2 a command calledinit
which will add a new settings.* file (defautls to toml) containing the scaffolding.So with this change, an application config file will look like this.
settings.toml
IN a
.secrets
file there is no reason to have differentenvs
as easch environment must have its own secrets file..secrets.toml
The variable
ENV_FOR_DYNACONF
must default toDEVELOPMENT
and when it is time to change a variable must be defined.export ENV_FOR_DYNACONF=PRODUCTION
That is all
Programatically switching namespaces may be useful for testing and also to use Dynaconf as a Feature flag system so to switch:
The higher precedence is always for the
DYNACONF
env it works as aglobal
and is namedDYNACONF
instead of GLOBAl to avoid conflicts with existing envvars.To overwrite values in any of the namespaces do:
The text was updated successfully, but these errors were encountered: