Modernize provider support
This commit is contained in:
@@ -75,7 +75,11 @@ class Config:
|
||||
|
||||
def get_config_dir() -> Path:
|
||||
"""Get the config directory, creating it if needed."""
|
||||
CONFIG_DIR.mkdir(parents=True, exist_ok=True)
|
||||
CONFIG_DIR.mkdir(parents=True, exist_ok=True, mode=0o700)
|
||||
try:
|
||||
CONFIG_DIR.chmod(0o700)
|
||||
except OSError:
|
||||
pass
|
||||
return CONFIG_DIR
|
||||
|
||||
|
||||
@@ -101,6 +105,10 @@ def save_config(config: Config) -> Path:
|
||||
"""Save configuration to disk."""
|
||||
config_path = get_config_dir() / "config.yaml"
|
||||
config_path.write_text(yaml.dump(config.to_dict(), default_flow_style=False, sort_keys=False))
|
||||
try:
|
||||
config_path.chmod(0o600)
|
||||
except OSError:
|
||||
pass
|
||||
return config_path
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user