fixed bug with spreadsheet import
This commit is contained in:
parent
b4aa8ce344
commit
c65ea40fcb
@ -4,12 +4,24 @@ import { exec } from 'child_process';
|
||||
import chokidar from 'chokidar';
|
||||
import path from 'path';
|
||||
import util from 'util';
|
||||
import dotenv from 'dotenv';
|
||||
|
||||
if (!process.env.ENVIRONMENT) {
|
||||
console.error("❌ Missing ENVIRONMENT variable.");
|
||||
process.exit(1);
|
||||
}
|
||||
dotenv.config();
|
||||
|
||||
// Determine the environment
|
||||
const environment = process.env.NODE_ENV || 'dev';
|
||||
const configFile = `config_${environment}.json`;
|
||||
const environment = process.env.ENVIRONMENT || 'dev';
|
||||
const nodeEnv = process.env.NODE_ENV || 'dev';
|
||||
const configFile = `config_${nodeEnv}.json`;
|
||||
|
||||
// Load the appropriate configuration
|
||||
if (!configFile) {
|
||||
console.error("❌ Configuration file path is missing.");
|
||||
process.exit(1);
|
||||
}
|
||||
let config;
|
||||
try {
|
||||
config = JSON.parse(fs.readFileSync(path.resolve('../', configFile), 'utf8'));
|
||||
@ -18,6 +30,10 @@ try {
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (!config.OPENAPI_URL || !config.SCHEMA_PATH || !config.OUTPUT_DIRECTORY || !config.SSL_KEY_PATH || !config.SSL_CERT_PATH) {
|
||||
console.error("❌ Missing essential configuration values.");
|
||||
process.exit(1);
|
||||
}
|
||||
const OPENAPI_URL = config.OPENAPI_URL;
|
||||
const SCHEMA_PATH = path.resolve(config.SCHEMA_PATH);
|
||||
const OUTPUT_DIRECTORY = path.resolve(config.OUTPUT_DIRECTORY);
|
||||
@ -111,10 +127,14 @@ async function fetchAndGenerate() {
|
||||
|
||||
// Define backendDirectory based on ENVIRONMENT variable
|
||||
const ENVIRONMENT = process.env.ENVIRONMENT || 'dev';
|
||||
const backendDirectory = ENVIRONMENT === 'test'
|
||||
const backendDirectory = environment === 'test'
|
||||
? path.resolve('/home/jungfrau/heidi-v2/backend/app')
|
||||
: path.resolve('/Users/gotthardg/PycharmProjects/heidi-v2/backend/app');
|
||||
|
||||
if (!backendDirectory) {
|
||||
console.error("❌ Failed to resolve backend directory path.");
|
||||
process.exit(1);
|
||||
}
|
||||
console.log(`👀 Watching for changes in ${backendDirectory}`);
|
||||
|
||||
const watcher = chokidar.watch(backendDirectory, { persistent: true, ignored: [SCHEMA_PATH, OUTPUT_DIRECTORY] });
|
||||
|
Loading…
x
Reference in New Issue
Block a user