MCPcopy Create free account
hub / github.com/TheNetsky/Microsoft-Rewards-Script / loadConfig

Function loadConfig

scripts/utils.js:81–102  ·  view source on GitHub ↗
(projectRoot)

Source from the content-addressed store, hash-verified

79}
80
81export function loadConfig(projectRoot) {
82 const possiblePaths = [
83 path.resolve(process.cwd(), 'config.json'),
84 path.join(projectRoot, 'config.json'),
85 path.join(projectRoot, 'dist', 'config.json'),
86 path.join(projectRoot, 'src', 'config.json')
87 ]
88
89 const result = loadJsonFile(possiblePaths, true)
90
91 const missingFields = []
92 if (!result.data.sessionPath) missingFields.push('sessionPath')
93
94 if (missingFields.length > 0) {
95 log('ERROR', 'Invalid config.json - missing required fields:')
96 missingFields.forEach(field => log('ERROR', ` - ${field}`))
97 log('ERROR', `Config file: ${result.path}`)
98 process.exit(1)
99 }
100
101 return result
102}
103
104export function loadEnvFile(projectRoot) {
105 const candidates = [

Callers 2

clearSessions.jsFile · 0.90
browserSession.jsFile · 0.90

Calls 2

loadJsonFileFunction · 0.85
logFunction · 0.85

Tested by

no test coverage detected