mirror of
https://github.com/dtomlinson91/csops.git
synced 2025-12-22 05:45:45 +00:00
feat: add user configuration of gcp_kms_key #1
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import os
|
||||
from typing import Any
|
||||
|
||||
import panaetius
|
||||
|
||||
|
||||
_config_path = os.environ.get("CSOPS_CONFIG")
|
||||
if _config_path is not None:
|
||||
CONFIG: Any = panaetius.Config("csops", _config_path, skiper_header_init=True)
|
||||
else:
|
||||
CONFIG = panaetius.Config("csops", "~/.config")
|
||||
|
||||
|
||||
panaetius.set_config(CONFIG, "gcp_kms_key")
|
||||
|
||||
@@ -2,12 +2,14 @@ import argparse
|
||||
import pathlib
|
||||
import subprocess
|
||||
|
||||
from csops import CONFIG
|
||||
|
||||
|
||||
def encrypt(args):
|
||||
encrypted_filename = f"{args.file.stem}.enc{args.file.suffix}"
|
||||
subprocess.run(
|
||||
"sops --encrypt --gcp-kms "
|
||||
f" projects/plex-mozilla-sops/locations/global/keyRings/sops/cryptoKeys/sops-key {args.file} > {encrypted_filename}",
|
||||
f"{CONFIG.gcp_kms_key} {args.file} > {encrypted_filename}",
|
||||
check=True,
|
||||
text=True,
|
||||
shell=True,
|
||||
|
||||
Reference in New Issue
Block a user