Skip to content

Commit

Permalink
Config file: use permissions=600 automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
zwimer committed Oct 30, 2024
1 parent 6123462 commit 10979a8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion rpipe/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__: str = "9.5.2" # Must be "<major>.<minor>.<patch>", all numbers
__version__: str = "9.5.3" # Must be "<major>.<minor>.<patch>", all numbers
3 changes: 2 additions & 1 deletion rpipe/client/client/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def load(cls, cli: dict[str, bool | str | Path | None], file: Path) -> Self:
conf = asdict(Config())
# Load config file then cli args
if file.exists():
file.chmod(_CONFIG_FILE_PERMISSIONS) # Update permissions in case permissions are bad
log.debug("Loading config file %s", file)
conf.update(loads(file.read_text(encoding="utf-8")))
else:
Expand All @@ -87,8 +88,8 @@ def save(self, file: Path) -> None:
log.warning("Creating config file: %s", file)
file.touch(mode=_CONFIG_FILE_PERMISSIONS)
log.debug("Permissions set to: %s", oct(_CONFIG_FILE_PERMISSIONS))
file.chmod(_CONFIG_FILE_PERMISSIONS) # Update permissions in case permissions are bad
file.write_text(dumps(asdict(self), default=str), encoding="utf-8")
file.chmod(_CONFIG_FILE_PERMISSIONS) # Update permissions in case permissions are bad
log.info("Config saved to %s", file)

def validate(self) -> None:
Expand Down

0 comments on commit 10979a8

Please sign in to comment.