Skip to content

Expand ~ in the credentials file path - #243

Open
Pawansingh3889 (Pawansingh3889) wants to merge 1 commit into
octopus-energy:mainfrom
Pawansingh3889:fix-expanduser-secrets-path
Open

Expand ~ in the credentials file path#243
Pawansingh3889 (Pawansingh3889) wants to merge 1 commit into
octopus-energy:mainfrom
Pawansingh3889:fix-expanduser-secrets-path

Conversation

@Pawansingh3889

Copy link
Copy Markdown

Closes #97.

_load_from_file passed the credentials path straight to open(), so a leading ~ was never expanded. A path like TENTACLIO__SECRETS_FILE=~/secrets.yaml was therefore treated as a literal ~/secrets.yaml in the working directory and raised TentaclioFileError, even though the file existed in the user's home.

Expanding with os.path.expanduser before opening fixes it, matching how a shell would resolve the path. Environment-variable interpolation was already handled; this adds the home-directory case.

Added a unit test that points a ~/secrets.yaml path at a temporary home and asserts the credentials load.

Closes octopus-energy#97. _load_from_file opened the secrets path directly, so a path
like ~/secrets.yaml (e.g. from TENTACLIO__SECRETS_FILE) was treated as a
literal ~ file and failed. Expand it with os.path.expanduser first.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expand '~' to user home when loading credentials file.

1 participant