@monodog/backend 1.4.6 → 1.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config-loader.js +6 -6
- package/dist/get-db-url.js +0 -1
- package/package.json +1 -1
- package/src/config-loader.ts +6 -6
- package/src/get-db-url.ts +0 -2
package/dist/config-loader.js
CHANGED
|
@@ -50,7 +50,7 @@ function loadConfig() {
|
|
|
50
50
|
// 1. Determine the path to the config file
|
|
51
51
|
// We assume the backend package is running from the monorepo root (cwd is root)
|
|
52
52
|
// or that we can navigate up to the root from the current file's location.
|
|
53
|
-
let rootPath = path.resolve(process.cwd()); // Adjust based on your workspace folder depth from root if needed
|
|
53
|
+
let rootPath = path.resolve(process.cwd(), '..', '..'); // Adjust based on your workspace folder depth from root if needed
|
|
54
54
|
let configPath = path.resolve(rootPath, 'monodog-conf.json');
|
|
55
55
|
createConfigFileIfMissing(rootPath);
|
|
56
56
|
if (!fs.existsSync(configPath)) {
|
|
@@ -64,7 +64,7 @@ function loadConfig() {
|
|
|
64
64
|
// 3. Optional: Add validation logic here (e.g., check if ports are numbers)
|
|
65
65
|
// Cache and return
|
|
66
66
|
config = parsedConfig;
|
|
67
|
-
process.stderr.write(
|
|
67
|
+
process.stderr.write('[Config] Loaded configuration from: ...\n');
|
|
68
68
|
return config;
|
|
69
69
|
}
|
|
70
70
|
catch (error) {
|
|
@@ -93,16 +93,16 @@ function createConfigFileIfMissing(rootPath) {
|
|
|
93
93
|
};
|
|
94
94
|
const contentString = JSON.stringify(defaultContent, null, 2);
|
|
95
95
|
// ---------------------
|
|
96
|
-
|
|
96
|
+
process.stderr.write(`\n[monodog] Checking for ${configFileName}...`);
|
|
97
97
|
if (fs.existsSync(configFilePath)) {
|
|
98
|
-
|
|
98
|
+
process.stderr.write(`[monodog] ${configFileName} already exists. Skipping creation.`);
|
|
99
99
|
}
|
|
100
100
|
else {
|
|
101
101
|
try {
|
|
102
102
|
// Write the default content to the file
|
|
103
103
|
fs.writeFileSync(configFilePath, contentString, 'utf-8');
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
process.stderr.write(`[monodog] Successfully generated default ${configFileName} in the workspace root.`);
|
|
105
|
+
process.stderr.write('[monodog] Please review and update settings like "host" and "port".');
|
|
106
106
|
}
|
|
107
107
|
catch (err) {
|
|
108
108
|
const message = err instanceof Error ? err.message : String(err);
|
package/dist/get-db-url.js
CHANGED
|
@@ -5,7 +5,6 @@ function generateUrl() {
|
|
|
5
5
|
const appConfig = (0, config_loader_1.loadConfig)();
|
|
6
6
|
const DATABASE_URL = `${appConfig.database.path}`;
|
|
7
7
|
process.env.DATABASE_URL = DATABASE_URL;
|
|
8
|
-
process.env.DATABASE_PORT = `${appConfig.database.port}`;
|
|
9
8
|
process.stdout.write(DATABASE_URL);
|
|
10
9
|
}
|
|
11
10
|
generateUrl();
|
package/package.json
CHANGED
package/src/config-loader.ts
CHANGED
|
@@ -36,7 +36,7 @@ export function loadConfig(): MonodogConfig {
|
|
|
36
36
|
// 1. Determine the path to the config file
|
|
37
37
|
// We assume the backend package is running from the monorepo root (cwd is root)
|
|
38
38
|
// or that we can navigate up to the root from the current file's location.
|
|
39
|
-
let rootPath = path.resolve(process.cwd()); // Adjust based on your workspace folder depth from root if needed
|
|
39
|
+
let rootPath = path.resolve(process.cwd(),'..','..'); // Adjust based on your workspace folder depth from root if needed
|
|
40
40
|
let configPath = path.resolve(rootPath, 'monodog-conf.json');
|
|
41
41
|
createConfigFileIfMissing(rootPath);
|
|
42
42
|
|
|
@@ -54,7 +54,7 @@ export function loadConfig(): MonodogConfig {
|
|
|
54
54
|
|
|
55
55
|
// Cache and return
|
|
56
56
|
config = parsedConfig;
|
|
57
|
-
process.stderr.write(
|
|
57
|
+
process.stderr.write('[Config] Loaded configuration from: ...\n');
|
|
58
58
|
return config;
|
|
59
59
|
|
|
60
60
|
} catch (error) {
|
|
@@ -88,16 +88,16 @@ const defaultContent = {
|
|
|
88
88
|
const contentString = JSON.stringify(defaultContent, null, 2);
|
|
89
89
|
// ---------------------
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
process.stderr.write(`\n[monodog] Checking for ${configFileName}...`);
|
|
92
92
|
|
|
93
93
|
if (fs.existsSync(configFilePath)) {
|
|
94
|
-
|
|
94
|
+
process.stderr.write(`[monodog] ${configFileName} already exists. Skipping creation.`);
|
|
95
95
|
} else {
|
|
96
96
|
try {
|
|
97
97
|
// Write the default content to the file
|
|
98
98
|
fs.writeFileSync(configFilePath, contentString, 'utf-8');
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
process.stderr.write(`[monodog] Successfully generated default ${configFileName} in the workspace root.`);
|
|
100
|
+
process.stderr.write('[monodog] Please review and update settings like "host" and "port".');
|
|
101
101
|
} catch (err: unknown) {
|
|
102
102
|
const message = err instanceof Error ? err.message : String(err);
|
|
103
103
|
console.error(`[monodog Error] Failed to generate ${configFileName}:`, message);
|