From 5dbf81ca0fa3d3c1e92e45cb2661d43d943fb4f4 Mon Sep 17 00:00:00 2001 From: someone <2+someone@noreply.localhost> Date: Fri, 24 Apr 2026 23:44:57 +0000 Subject: [PATCH] Sync workflow/WorkflowConfig.gs --- workflow/WorkflowConfig.gs | 46 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 workflow/WorkflowConfig.gs diff --git a/workflow/WorkflowConfig.gs b/workflow/WorkflowConfig.gs new file mode 100644 index 0000000..ba2ac51 --- /dev/null +++ b/workflow/WorkflowConfig.gs @@ -0,0 +1,46 @@ +/** + * WorkflowConfig - Centralized configuration management + * Uses PropertiesService to keep secrets out of the codebase. + */ + +function getWorkflowConfig() { + const props = PropertiesService.getScriptProperties().getProperties(); + return props; +} + +function getRequiredProperty_(key) { + const value = PropertiesService.getScriptProperties().getProperty(key); + if (!value) { + throw new Error(`Missing required configuration property: ${key}. Please set it in Project Settings > Script Properties.`); + } + return value; +} + +function getOptionalProperty_(key, fallback) { + const value = PropertiesService.getScriptProperties().getProperty(key); + return value !== null ? value : fallback; +} + +function getVikunjaConfig() { + return { + baseUrl: getRequiredProperty_('VIKUNJA_BASE_URL'), + token: getRequiredProperty_('VIKUNJA_TOKEN'), + projectId: getOptionalProperty_('VIKUNJA_DEFAULT_PROJECT_ID', null) + }; +} + +function getTestProjectConfig() { + return { + testProjectId: getOptionalProperty_('VIKUNJA_TEST_PROJECT_ID', null) + }; +} + +function getGiteaConfig() { + return { + baseUrl: getRequiredProperty_('GITEA_BASE_URL'), + token: getRequiredProperty_('GITEA_TOKEN'), + owner: getRequiredProperty_('GITEA_OWNER'), + repo: getRequiredProperty_('GITEA_REPO'), + branch: getOptionalProperty_('GITEA_DEFAULT_BRANCH', 'main') + }; +}