From d3877f1a695d51769f8665cb17daef4ccffa55e5 Mon Sep 17 00:00:00 2001 From: Til Jordan <45370031+tiljrd@users.noreply.github.com> Date: Wed, 30 Apr 2025 02:13:39 +0100 Subject: [PATCH] Allow additional env vars --- main.star | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/main.star b/main.star index c940991..14ad66f 100644 --- a/main.star +++ b/main.star @@ -26,6 +26,7 @@ def run( config_file_artifact_name="", seed_file_artifact_name="", extra_configs=[], + extra_env_vars={}, persistent=True, launch_adminer=False, min_cpu=POSTGRES_MIN_CPU, @@ -47,6 +48,7 @@ def run( seed_file_artifact_name (string): The name of a files artifact containing seed data If not empty, the Postgres server will be populated with the data upon start extra_configs (list[string]): Each argument gets passed as a '-c' argument to the Postgres server + extra_env_vars dict[string, string]: A dict mapping environment variable names to their values; every pair is added to the Postgres container environment. persistent (bool): Whether the data should be persisted. Defaults to True; Note that this isn't supported on multi node k8s cluster as of 2023-10-16 launch_adminer (bool): Whether to launch adminer which launches a website to inspect postgres database entries. Defaults to False. min_cpu (int): Define how much CPU millicores the service should be assigned at least. @@ -92,6 +94,10 @@ def run( "POSTGRES_PASSWORD": password, } + # Add extra env vars + for k, v in extra_env_vars.items(): + env_vars[k] = v + if persistent: files[DATA_DIRECTORY_PATH] = Directory( persistent_key= "data-{0}".format(service_name),