prole/etc/sync-prole-cfg.py
chrisfu e3c2e625f1 refactor(config): separate k3d k3s and gke config entrypoints
Rename env config files from conf/*/prole.cfg to conf/k3d.cfg, conf/k3s.cfg, and conf/gke.cfg. Update shell/Python loaders and etc/deploy scripts to resolve named configs cleanly while keeping legacy fallback behavior. Align k3s Ansible tasks, docs, and regression coverage with the new configuration layout.

Co-authored-by: Junie <junie@jetbrains.com>
2026-04-11 22:20:45 -07:00

34 lines
916 B
Python

#!/usr/bin/env python3
import sys
from pathlib import Path
# Add project root to path
ROOT_DIR = Path(__file__).resolve().parents[1]
sys.path.append(str(ROOT_DIR))
from knoe import config as inst_config
def main():
vault_path = (
ROOT_DIR
/ "infrastructure"
/ "inventory"
/ "group_vars"
/ "all"
/ "vault_k3s.yml"
)
token = inst_config._try_read_ansible_vault_value(vault_path, "vault_k3s_token")
if token:
print("Syncing K3S_TOKEN to active config...")
inst_config._update_prole_cfg_value("Global", "PROLE_K3S_TOKEN", token)
inst_config._update_prole_cfg_value("Inputs", "init_cluster.k3s_token", token)
inst_config._update_prole_cfg_value("Service Cluster (k3s)", "K3S_TOKEN", token)
else:
print("Warning: Could not extract vault_k3s_token from Ansible vault.")
if __name__ == "__main__":
main()