From d16b693aab52465c3e2255c7879bac2562472ec1 Mon Sep 17 00:00:00 2001 From: Joachim Hummel Date: Fri, 26 Jun 2026 17:09:22 +0200 Subject: [PATCH] first commit --- README.md | 1 + build_select_options.py | 50 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 README.md create mode 100644 build_select_options.py diff --git a/README.md b/README.md new file mode 100644 index 0000000..d6800c3 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +Kestra diff --git a/build_select_options.py b/build_select_options.py new file mode 100644 index 0000000..819aea8 --- /dev/null +++ b/build_select_options.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python3 + +import base64 +import json +import os +import sys + + +def main(): + raw_json = os.environ.get("OPTIONS_B64_JSON", "[]").strip() + + try: + options_b64 = json.loads(raw_json) + except json.JSONDecodeError as exc: + print(f"FEHLER: OPTIONS_B64_JSON ist kein gültiges JSON: {exc}", file=sys.stderr) + sys.exit(1) + + options = [] + + for raw in options_b64: + if not raw: + continue + + raw = str(raw).strip() + if not raw: + continue + + try: + decoded = base64.b64decode(raw).decode("utf-8") + options.extend(json.loads(decoded)) + except Exception as exc: + print(f"WARNUNG: Ein Host-Ergebnis konnte nicht gelesen werden: {exc}", file=sys.stderr) + + options = sorted(set(options)) + + with open("select_options.json", "w", encoding="utf-8") as f: + json.dump(options, f, indent=2, ensure_ascii=False) + + print("==========================================") + print("Dropdown-Liste gebaut") + print(f"Dropdown-Optionen: {len(options)}") + print("==========================================") + + print("") + print("Dropdown-Liste:") + print(json.dumps(options, indent=2, ensure_ascii=False)) + + +if __name__ == "__main__": + main()