Add folder-based service account onboarding
This commit is contained in:
+12
-1
@@ -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}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user