kstlib 1.1.0__py3-none-any.whl → 1.1.1__py3-none-any.whl
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.
- kstlib/cli/commands/secrets/common.py +43 -0
- kstlib/cli/commands/secrets/encrypt.py +4 -4
- kstlib/meta.py +1 -1
- {kstlib-1.1.0.dist-info → kstlib-1.1.1.dist-info}/METADATA +1 -1
- {kstlib-1.1.0.dist-info → kstlib-1.1.1.dist-info}/RECORD +9 -9
- {kstlib-1.1.0.dist-info → kstlib-1.1.1.dist-info}/WHEEL +0 -0
- {kstlib-1.1.0.dist-info → kstlib-1.1.1.dist-info}/entry_points.txt +0 -0
- {kstlib-1.1.0.dist-info → kstlib-1.1.1.dist-info}/licenses/LICENSE.md +0 -0
- {kstlib-1.1.0.dist-info → kstlib-1.1.1.dist-info}/top_level.txt +0 -0
|
@@ -222,6 +222,48 @@ def run_sops_command(binary: str, arguments: list[str]) -> CompletedProcess[str]
|
|
|
222
222
|
)
|
|
223
223
|
|
|
224
224
|
|
|
225
|
+
def find_sops_config(start_path: Path | None = None) -> Path | None:
|
|
226
|
+
"""Find .sops.yaml by searching from start_path up to root, then home.
|
|
227
|
+
|
|
228
|
+
This mimics the native sops behavior which searches for configuration
|
|
229
|
+
files starting from the current directory and walking up to the root,
|
|
230
|
+
then falling back to the user home directory.
|
|
231
|
+
|
|
232
|
+
Args:
|
|
233
|
+
start_path: Directory to start searching from. If None, uses cwd.
|
|
234
|
+
|
|
235
|
+
Returns:
|
|
236
|
+
Path to .sops.yaml if found, None otherwise.
|
|
237
|
+
"""
|
|
238
|
+
config_name = ".sops.yaml"
|
|
239
|
+
|
|
240
|
+
# Start from provided path or current working directory
|
|
241
|
+
if start_path is not None:
|
|
242
|
+
current = start_path.resolve()
|
|
243
|
+
if current.is_file():
|
|
244
|
+
current = current.parent
|
|
245
|
+
else:
|
|
246
|
+
current = Path.cwd()
|
|
247
|
+
|
|
248
|
+
# Walk up the directory tree
|
|
249
|
+
while True:
|
|
250
|
+
candidate = current / config_name
|
|
251
|
+
if candidate.is_file():
|
|
252
|
+
return candidate
|
|
253
|
+
parent = current.parent
|
|
254
|
+
if parent == current:
|
|
255
|
+
# Reached root
|
|
256
|
+
break
|
|
257
|
+
current = parent
|
|
258
|
+
|
|
259
|
+
# Fallback to home directory
|
|
260
|
+
home_config = Path.home() / config_name
|
|
261
|
+
if home_config.is_file():
|
|
262
|
+
return home_config
|
|
263
|
+
|
|
264
|
+
return None
|
|
265
|
+
|
|
266
|
+
|
|
225
267
|
def resolve_sops_binary() -> str:
|
|
226
268
|
"""Return the configured sops binary name if set, otherwise the default."""
|
|
227
269
|
default_binary = "sops"
|
|
@@ -418,6 +460,7 @@ __all__ = [
|
|
|
418
460
|
"Path",
|
|
419
461
|
"SecureDeleteCLIOptions",
|
|
420
462
|
"ShredCommandOptions",
|
|
463
|
+
"find_sops_config",
|
|
421
464
|
"format_arguments",
|
|
422
465
|
"resolve_sops_binary",
|
|
423
466
|
"run_sops_command",
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from pathlib import Path
|
|
6
5
|
from typing import TYPE_CHECKING
|
|
7
6
|
|
|
8
7
|
import typer
|
|
@@ -31,7 +30,9 @@ from .common import (
|
|
|
31
30
|
SHRED_PASSES_OPTION,
|
|
32
31
|
SHRED_ZERO_LAST_OPTION,
|
|
33
32
|
EncryptCommandOptions,
|
|
33
|
+
Path,
|
|
34
34
|
SecureDeleteCLIOptions,
|
|
35
|
+
find_sops_config,
|
|
35
36
|
format_arguments,
|
|
36
37
|
resolve_sops_binary,
|
|
37
38
|
run_sops_command,
|
|
@@ -213,9 +214,8 @@ def encrypt(
|
|
|
213
214
|
binary = resolve_sops_binary()
|
|
214
215
|
effective_config = config
|
|
215
216
|
if effective_config is None:
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
effective_config = default_config
|
|
217
|
+
# Search for .sops.yaml from source file directory up to root, then home
|
|
218
|
+
effective_config = find_sops_config(source)
|
|
219
219
|
|
|
220
220
|
options = EncryptCommandOptions(
|
|
221
221
|
out=out,
|
kstlib/meta.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: kstlib
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.1
|
|
4
4
|
Summary: Config-driven helpers for Python projects (dynamic config, secure secrets, preset logging, and more…)
|
|
5
5
|
Author-email: Michel TRUONG <michel.truong@gmail.com>
|
|
6
6
|
Maintainer-email: Michel TRUONG <michel.truong@gmail.com>
|
|
@@ -2,7 +2,7 @@ kstlib/__init__.py,sha256=MO6fLXlSp_EKA-itBMmPMPoQDLja9MTMxGSgMFicaZE,10518
|
|
|
2
2
|
kstlib/__main__.py,sha256=l9-cxF6BGDYCb-giF4hDEewFv5ytrhKZTxfsVenUB3A,323
|
|
3
3
|
kstlib/kstlib.conf.yml,sha256=qqfg4rfEtJAXkE5ujML864yq46lGQaSN2p0PTPgJegA,30040
|
|
4
4
|
kstlib/limits.py,sha256=i3E1O_qvniUlJoyzh6Gv14h7faqxEwydX6Gk6uOHCFo,31578
|
|
5
|
-
kstlib/meta.py,sha256=
|
|
5
|
+
kstlib/meta.py,sha256=7CG0R4S3ZyZSjuNBKTiyHvdbJCP_D1VcND_nmpApfmU,6149
|
|
6
6
|
kstlib/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
7
|
kstlib/ssl.py,sha256=LudzVfYFAoSxKFyEzACQlYnjPmuusoRl4tAPPsdBBmU,10355
|
|
8
8
|
kstlib/alerts/__init__.py,sha256=mixRr15D5jIhoyLWn6PWrZI6K-urwuw0aMBzMGhqTXQ,3153
|
|
@@ -54,10 +54,10 @@ kstlib/cli/commands/rapi/call.py,sha256=hMLpZ8SFinLjwFpAHnl2bGzMbLZxUiZzm5e-pR6o
|
|
|
54
54
|
kstlib/cli/commands/rapi/list.py,sha256=Sm8MbcYklevhmvZMnqvez3Hsl1dx_Pclc_M-hSUcEMw,7873
|
|
55
55
|
kstlib/cli/commands/rapi/show.py,sha256=dLRq5WeG3wvoysEt8ivNp06wHep14PvQNaiAlRVJQrQ,7599
|
|
56
56
|
kstlib/cli/commands/secrets/__init__.py,sha256=qxmuaeAgyVexnnOx72oqNOFJNBsn-CtEuMrXSAu3_vk,760
|
|
57
|
-
kstlib/cli/commands/secrets/common.py,sha256=
|
|
57
|
+
kstlib/cli/commands/secrets/common.py,sha256=y8KMQkWEc7qDVMJkzobMdHGsgoIeLwsOmYjq7TAe478,13277
|
|
58
58
|
kstlib/cli/commands/secrets/decrypt.py,sha256=Qrkx-xHIahbr8SRk4YvD8ddWazHcy8Ur6HhNiaEmxfE,2380
|
|
59
59
|
kstlib/cli/commands/secrets/doctor.py,sha256=KptEKMIaBTO1sftqDSr4LzuvCZPetigOjBh3ddaMems,25987
|
|
60
|
-
kstlib/cli/commands/secrets/encrypt.py,sha256=
|
|
60
|
+
kstlib/cli/commands/secrets/encrypt.py,sha256=vggzg44hwc6EUW_cv44qtmsaT-4DPY3RqF6Zb73Ao_U,7827
|
|
61
61
|
kstlib/cli/commands/secrets/shred.py,sha256=V0ndvIib4chiHq_7YqkliQ06GI9pQfGCc7xTPtiKx-U,2732
|
|
62
62
|
kstlib/config/__init__.py,sha256=urn7ZmbYMgDEIbZFxFA7wrgutscIptH1BqbS17FuYWQ,1805
|
|
63
63
|
kstlib/config/exceptions.py,sha256=MJqo_j5_WJU1pxbNYdpOqD5VqYbdQ2a-pCKzufcUk0c,2758
|
|
@@ -155,9 +155,9 @@ kstlib/websocket/__init__.py,sha256=yNpCeg3S0NA61WEOIaVW2-DeFFdPyNhFpV4Xi7ZEUT4,
|
|
|
155
155
|
kstlib/websocket/exceptions.py,sha256=Mku-3SoaadbRwQZLR7Rx5J4VVrp8wwJjKnCWOOxse3s,5957
|
|
156
156
|
kstlib/websocket/manager.py,sha256=rxiQ1N-H9PVWl9WEr_24QxeIHu9j8REL4GH31QrmTSg,42587
|
|
157
157
|
kstlib/websocket/models.py,sha256=-Ooe2oZJLH9wAW9_yZyUE1mreaguQZK3c4Y_Zt8MOgM,10986
|
|
158
|
-
kstlib-1.1.
|
|
159
|
-
kstlib-1.1.
|
|
160
|
-
kstlib-1.1.
|
|
161
|
-
kstlib-1.1.
|
|
162
|
-
kstlib-1.1.
|
|
163
|
-
kstlib-1.1.
|
|
158
|
+
kstlib-1.1.1.dist-info/licenses/LICENSE.md,sha256=y9Wv0ooml-DVaNOLi2BKvWJyklSACRKnLGOYXhnrdiQ,1077
|
|
159
|
+
kstlib-1.1.1.dist-info/METADATA,sha256=oyCiXhTVc0iEHeMhg7GHOmzuMyrcODoAc3FqVKeZfbw,7766
|
|
160
|
+
kstlib-1.1.1.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
161
|
+
kstlib-1.1.1.dist-info/entry_points.txt,sha256=mqwbGFeHB_sJYnZMTpx-_64FPW6apGcfeK8VvObs5jM,48
|
|
162
|
+
kstlib-1.1.1.dist-info/top_level.txt,sha256=tgPJhgVk1CqZM_mx4fmT0_GUKmnLpJuntTo5GMs7EOs,7
|
|
163
|
+
kstlib-1.1.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|