-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.js
29 lines (24 loc) · 824 Bytes
/
config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import fs from 'fs';
import path from 'path';
// Default configuration
const defaultConfig = {
dockerServicesDestination: '.docker',
parentDockerComposeFile: 'docker-compose.yml'
};
// Path to the .rudder file
const configPath = path.join(process.cwd(), '.rudder');
// Load and parse the .rudder file
let userConfig = {};
try {
if (fs.existsSync(configPath)) {
const rawConfig = fs.readFileSync(configPath, 'utf-8');
userConfig = JSON.parse(rawConfig);
} else {
console.warn('.rudder file not found. Using default configuration.');
}
} catch (error) {
console.error('Error reading or parsing .rudder file:', error);
}
// Merge defaultConfig with userConfig (userConfig properties will overwrite defaultConfig properties)
const config = { ...defaultConfig, ...userConfig };
export default config;