dynaconf / dynaconf

Configuration Management for Python ⚙
https://dynaconf.com
MIT License
3.8k stars 293 forks source link

[bug] Format fields in default scope not inherited when using preload #1179

Open franklucky001 opened 2 months ago

franklucky001 commented 2 months ago

Describe the bug Dynaconf: Format fields in default scope not inherited when using preload, but work with settings_files

To Reproduce Steps to reproduce the behavior:

  1. define preload config
    
    default:
    nacos_config:
    server_address: "@format {this.nacos_config.host}:{this.nacos_config.port}"

development: nacos_config: host: "192.168.1.100" port: 8848

2. init settings by Dynaconf
```python
settings = Dynaconf(
    envvar_prefix="DYNACONF",
    environments=True,
    preload=['config.toml'],
    settings_files=['conf/settings.toml', 'conf/.secrets.toml'],
    LOADERS_FOR_DYNACONF=[
        "dynaconf.loaders.env_loader",
        "dynaconf.loaders.toml_loader",
        "table_qa_engine.utils.nacos.loader",
    ]
)
  1. use settings.nacos_config.server_address, get AttributeError, but all format fields are correctly inherited when using the settings_files option