Sync workflow/WorkflowConfig.gs
This commit is contained in:
@@ -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')
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user