Sanitized single-commit public mirror of recipe-maintainer. - Removed test-ssh/.testenv (live creds); added test-ssh/.testenv.example placeholders. - Removed plans/ and planned-updates/ (deployment-planning docs) so no client/ deployment domains appear in the public repo. - All other secret stores were already gitignored. - docs.coopcloud.tech retained as a submodule (public upstream).
57 lines
1.6 KiB
Python
57 lines
1.6 KiB
Python
#!/usr/bin/env python3
|
|
"""Get instance info, optionally with a recipe domain.
|
|
|
|
Usage:
|
|
python3 scripts/get_test_instance.py
|
|
python3 scripts/get_test_instance.py --recipe hedgedoc
|
|
python3 scripts/get_test_instance.py --recipe hedgedoc --instance t1cc
|
|
|
|
Output (without --recipe):
|
|
SERVER=b1cc.commoninternet.net
|
|
INSTANCE=b1cc
|
|
|
|
Output (with --recipe):
|
|
DOMAIN=hedgedoc.b1cc.commoninternet.net
|
|
SERVER=b1cc.commoninternet.net
|
|
INSTANCE=b1cc
|
|
"""
|
|
|
|
import argparse
|
|
import os
|
|
import sys
|
|
|
|
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
|
|
from lib.config import get_default_instance_name, load_instance_toml, load_recipe_toml
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(
|
|
description="Get instance info, optionally with a recipe domain"
|
|
)
|
|
parser.add_argument("--recipe", default=None, help="Recipe name (optional)")
|
|
parser.add_argument("--instance", default=None,
|
|
help="Instance name (default: from settings.toml)")
|
|
args = parser.parse_args()
|
|
|
|
if args.instance:
|
|
instance_name = args.instance
|
|
else:
|
|
instance_name = get_default_instance_name()
|
|
|
|
inst_data = load_instance_toml(instance_name)
|
|
server = inst_data.get("server", f"{instance_name}.commoninternet.net")
|
|
|
|
if args.recipe:
|
|
domain_suffix = inst_data.get("domain_suffix", f"{instance_name}.commoninternet.net")
|
|
recipe_data = load_recipe_toml(args.recipe)
|
|
domain = recipe_data.get("domain", f"{args.recipe}.{domain_suffix}")
|
|
print(f"DOMAIN={domain}")
|
|
|
|
print(f"SERVER={server}")
|
|
print(f"INSTANCE={instance_name}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|