MCPcopy Create free account
hub / github.com/AI45Lab/Code / findConfig

Function findConfig

sdk/node/examples/basic/test_runtime_nesting.ts:26–43  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

24const __dirname = path.dirname(__filename);
25
26function findConfig(): string {
27 if (process.env.A3S_CONFIG) return process.env.A3S_CONFIG;
28 // Try configs directory first (for testing)
29 const configsDir = path.join(__dirname, '..', 'configs', 'test_config.acl');
30 if (fs.existsSync(configsDir)) return configsDir;
31 // Then try standard locations
32 const homeConfig = path.join(os.homedir(), '.a3s', 'config.acl');
33 if (fs.existsSync(homeConfig)) return homeConfig;
34 let p = path.resolve(__dirname);
35 for (let i = 0; i < 10; i++) {
36 const c = path.join(p, '.a3s', 'config.acl');
37 if (fs.existsSync(c)) return c;
38 const parent = path.dirname(p);
39 if (parent === p) break;
40 p = parent;
41 }
42 throw new Error('Config not found. Create configs/test_config.acl, ~/.a3s/config.acl, or set A3S_CONFIG');
43}
44
45function hasRealProviderConfig(configPath: string): boolean {
46 if (process.env.A3S_CONFIG) return true;

Callers 3

simulateNestedRuntimeFunction · 0.85
testConcurrentSessionsFunction · 0.85
mainFunction · 0.85

Calls 1

resolveMethod · 0.80

Tested by

no test coverage detected