Add folder-based service account onboarding

This commit is contained in:
2026-07-18 12:38:51 +01:00
parent 2dfe6aac03
commit 00d0db8255
3 changed files with 109 additions and 12 deletions
+12 -1
View File
@@ -128,6 +128,15 @@ function loadConfig() {
return config;
}
function getConfigBaseDir(config) {
const configPath = config && (config.__configPath || config.configPath);
if (configPath) {
return path.dirname(configPath);
}
return process.cwd();
}
function resolveOutputPath(outputDir, filename) {
if (!path.isAbsolute(outputDir)) {
outputDir = path.resolve(process.cwd(), outputDir);
@@ -203,6 +212,8 @@ function validateConfig(config) {
// Ensure service account credential paths are unique when using serviceAccounts
if (hasSvcAccounts) {
const baseDir = getConfigBaseDir(config);
for (const item of config.serviceAccounts) {
if (typeof item === 'string') {
if (!item.trim()) {
@@ -231,7 +242,7 @@ function validateConfig(config) {
if (typeof item === 'string') p = item.trim();
else if (item && typeof item === 'object') p = (item.path || item.file || item.credentialsPath || '').toString().trim();
if (!p) return '';
const full = path.isAbsolute(p) ? p : path.resolve(process.cwd(), p);
const full = path.isAbsolute(p) ? p : path.resolve(baseDir, p);
if (!fs.existsSync(full)) {
throw new Error(`Service account file not found: ${p}`);
}