Add stateful and stateless enterprise selection
This commit is contained in:
1 parent
d383b3aad8
commit
0959cef1cc
22 files changed
+609
-187
No files matched your search
+13
-12
@@ -1,22 +1,23 @@
|
||||
import { getEnterprisesDirCandidates, loadCorpConfigs } from "./core/config/loader.js";
|
||||
import { getEnterprisesDirCandidates, loadCorpConfigs, loadGlobalConfig } from "./core/config/loader.js";
|
||||
import { resolveCorpConfig } from "./core/config/manager.js";
|
||||
import { createSealClient } from "./core/http/factory.js";
|
||||
import { resolveLiveSealEnterpriseConfig } from "./domains/seal/source.js";
|
||||
import { getApprovalContext } from "./domains/seal/api.js";
|
||||
|
||||
async function main() {
|
||||
const corpId = Bun.argv[2];
|
||||
const args = Bun.argv.slice(2);
|
||||
const corpId = args[0] === "--corp" ? args[1] : args[0];
|
||||
const corps = loadCorpConfigs();
|
||||
const corp = corpId
|
||||
? corps.find((item) => item.id === corpId)
|
||||
: corps[0];
|
||||
|
||||
if (!corp) {
|
||||
throw new Error(
|
||||
const globalConfig = loadGlobalConfig();
|
||||
const corp = resolveCorpConfig(
|
||||
corps,
|
||||
{
|
||||
stateful: globalConfig.stateful,
|
||||
defaultCorpId: globalConfig.defaultCorpId,
|
||||
corpId
|
||||
? `No enterprise config found for ${corpId}`
|
||||
: `No enterprise config found. Add a config file under one of: ${getEnterprisesDirCandidates().join(", ")}`
|
||||
);
|
||||
}
|
||||
},
|
||||
getEnterprisesDirCandidates()
|
||||
);
|
||||
|
||||
console.log(`[probe] corp=${corp.id} source=${corp.source.type}`);
|
||||
|
||||
|
||||
Reference in new issue
Block a user