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
The application should look for the config file in multiple different locations, such as:
<platformdirs directory>/config.toml (current)
./config.toml
/etc/harbor_cli/config.toml
/usr/local/etc/harbor_cli/config.toml
We'll have to decide what the priority should be. Configs in user directories (default appdir location, $(pwd) and /usr/local/etc) should definitely take priority over site config dirs (/etc).
Possible implementation
# dirs.pyCONFIG_DIR=Path(_PLATFORM_DIR.user_config_dir)
SITE_CONFIG_DIR=Path(_PLATFORM_DIR.site_config_dir)
# config.pyCONFIG_FILENAME="config.toml"DEFAULT_CONFIG_FILE=CONFIG_DIR/"config.toml"classHarborCLIConfig(BaseModel):
# ...@classmethoddeffrom_file(
cls, config_file: Path|None=None, create: bool=False
) ->HarborCLIConfig:
ifconfig_fileisNone:
config_file=find_config_file()
# ...deffind_config_file() ->Path:
"""Attempts to find a config file. Falls back on the default config file location if a config file cannot be found in any of the expected locations."""fordin [Path(""), CONFIG_DIR, SITE_CONFIG_DIR]:
p=d/CONFIG_FILENAMEifp.exists():
returnpreturnDEFAULT_CONFIG_FILE# fall back on default (may not exist yet)
The text was updated successfully, but these errors were encountered:
The application should look for the config file in multiple different locations, such as:
<platformdirs directory>/config.toml
(current)./config.toml
/etc/harbor_cli/config.toml
/usr/local/etc/harbor_cli/config.toml
We'll have to decide what the priority should be. Configs in user directories (default appdir location,
$(pwd)
and/usr/local/etc
) should definitely take priority over site config dirs (/etc
).Possible implementation
The text was updated successfully, but these errors were encountered: