shhh 0.0.0.dev0__tar.gz → 0.0.0.dev1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: shhh
|
|
3
|
-
Version: 0.0.0.
|
|
3
|
+
Version: 0.0.0.dev1
|
|
4
4
|
Summary: Simple environment secret accessor for Python.
|
|
5
5
|
Author: Anatoly Frolov (anafro)
|
|
6
6
|
Author-email: anatolyfroloff@gmail.com
|
|
@@ -10,7 +10,7 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
10
10
|
Classifier: Programming Language :: Python :: 3.14
|
|
11
11
|
Description-Content-Type: text/markdown
|
|
12
12
|
|
|
13
|
-
# Shhh
|
|
13
|
+
# Shhh
|
|
14
14
|
|
|
15
15
|
**Shhh** is a dead simple secret accessor, that retrieves environment
|
|
16
16
|
secrets, and secrets from files.
|
|
@@ -34,11 +34,12 @@ poetry add shhh
|
|
|
34
34
|
The only function is **Shhh** is `get_secret`.
|
|
35
35
|
It returns an environment variable, unless a file exists on path provided in `XXX_FILE` variable.
|
|
36
36
|
For example:
|
|
37
|
+
|
|
37
38
|
```py
|
|
38
39
|
username: str = get_secret("APP_USERNAME")
|
|
39
40
|
```
|
|
40
41
|
|
|
41
|
-
|
|
42
|
+
**Shhh** searches for a file on path provided in `APP_USERNAME_FILE` variable and, if it exists,
|
|
42
43
|
returns its content. Otherwise, returns the value of `APP_USERNAME` variable.
|
|
43
44
|
|
|
44
45
|
## License
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Shhh
|
|
1
|
+
# Shhh
|
|
2
2
|
|
|
3
3
|
**Shhh** is a dead simple secret accessor, that retrieves environment
|
|
4
4
|
secrets, and secrets from files.
|
|
@@ -22,11 +22,12 @@ poetry add shhh
|
|
|
22
22
|
The only function is **Shhh** is `get_secret`.
|
|
23
23
|
It returns an environment variable, unless a file exists on path provided in `XXX_FILE` variable.
|
|
24
24
|
For example:
|
|
25
|
+
|
|
25
26
|
```py
|
|
26
27
|
username: str = get_secret("APP_USERNAME")
|
|
27
28
|
```
|
|
28
29
|
|
|
29
|
-
|
|
30
|
+
**Shhh** searches for a file on path provided in `APP_USERNAME_FILE` variable and, if it exists,
|
|
30
31
|
returns its content. Otherwise, returns the value of `APP_USERNAME` variable.
|
|
31
32
|
|
|
32
33
|
## License
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "shhh"
|
|
3
|
-
version = "0.0.0-dev"
|
|
3
|
+
version = "0.0.0-dev.1"
|
|
4
4
|
description = "Simple environment secret accessor for Python."
|
|
5
5
|
authors = [
|
|
6
|
-
|
|
6
|
+
{ name = "Anatoly Frolov (anafro)", email = "anatolyfroloff@gmail.com" },
|
|
7
7
|
]
|
|
8
8
|
readme = "README.md"
|
|
9
9
|
requires-python = ">=3.13"
|
|
10
|
-
dependencies = [
|
|
11
|
-
]
|
|
10
|
+
dependencies = []
|
|
12
11
|
|
|
13
12
|
|
|
14
13
|
[build-system]
|
|
@@ -10,6 +10,14 @@ def get_secret(name: str) -> str:
|
|
|
10
10
|
|
|
11
11
|
if filename_env_key in env:
|
|
12
12
|
environment_secret_filepath: Path = Path(env[filename_env_key])
|
|
13
|
+
if (
|
|
14
|
+
not environment_secret_filepath.exists()
|
|
15
|
+
or not environment_secret_filepath.is_file()
|
|
16
|
+
):
|
|
17
|
+
raise ValueError(
|
|
18
|
+
f"{filename_env_key} is provided, but that file not found (that path hidden for security purposes).\nDid you forget to provide that file via docker volumes, for example?"
|
|
19
|
+
)
|
|
20
|
+
|
|
13
21
|
with open(environment_secret_filepath, "r") as secret_file:
|
|
14
22
|
return secret_file.read()
|
|
15
23
|
|