From 5ad13796b1af51c32adcb404a000306c09ae56c6 Mon Sep 17 00:00:00 2001 From: someone <2+someone@noreply.localhost> Date: Fri, 24 Apr 2026 17:41:44 +0000 Subject: [PATCH] Sync src/WorkflowConfig.gs --- src/WorkflowConfig.gs | 46 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/WorkflowConfig.gs diff --git a/src/WorkflowConfig.gs b/src/WorkflowConfig.gs new file mode 100644 index 0000000..ba2ac51 --- /dev/null +++ b/src/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') + }; +}