prole/mock_val/sync-knoe-cfg.py
chrisfu 11064cbd5b refactor(mock_val): rename prole_* shell lib and cfg tooling to knoe_* namespace
Shell library (mock_val/lib/shell/):
  - Delete prole_cmd.sh, prole_env.sh, prole_guardrails.sh,
    prole_secrets.sh, prole_string.sh, prole_yaml.sh
  - Add knoe_* equivalents with same functionality

Config tooling:
  - Delete mock_val/prole_cfg.sh, mock_val/sync-prole-cfg.py
  - Add mock_val/knoe_cfg.sh, mock_val/sync-knoe-cfg.py

Mirrors the broader prole → knoe project rename.

Co-authored-by: Junie <junie@jetbrains.com>
2026-05-23 21:31:14 -07:00

28 lines
807 B
Python

#!/usr/bin/env python3
import sys
from pathlib import Path
ROOT_DIR = Path(__file__).resolve().parents[1]
sys.path.append(str(ROOT_DIR))
from knoe import config as inst_config
from knoe.core.onepassword import get_secret, op_available
def main():
token = ""
if op_available():
token = get_secret("k3s-token", "credential").strip()
if token:
print("Syncing K3S_TOKEN to active config...")
inst_config._update_knoe_cfg_value("Global", "PROLE_K3S_TOKEN", token)
inst_config._update_knoe_cfg_value("Inputs", "init_cluster.k3s_token", token)
inst_config._update_knoe_cfg_value("Service Cluster (k3s)", "K3S_TOKEN", token)
else:
print("Warning: Could not retrieve k3s-token from 1Password knoey vault.")
if __name__ == "__main__":
main()