fixed missing env
This commit is contained in:
parent
797e9bac4f
commit
08bd77efb7
2 changed files with 52 additions and 40 deletions
|
|
@ -256,6 +256,9 @@ module.exports = (pool, query, authMiddleware) => {
|
||||||
envContent += `DB_PASSWORD=${config.db.password}\n`;
|
envContent += `DB_PASSWORD=${config.db.password}\n`;
|
||||||
envContent += `DB_NAME=${config.db.database}\n`;
|
envContent += `DB_NAME=${config.db.database}\n`;
|
||||||
envContent += `DB_PORT=${config.db.port}\n`;
|
envContent += `DB_PORT=${config.db.port}\n`;
|
||||||
|
envContent += `POSTGRES_USER=${config.db.user}\n`;
|
||||||
|
envContent += `POSTGRES_PASSWORD=${config.db.password}\n`;
|
||||||
|
envContent += `POSTGRES_DB=${config.db.database}\n`;
|
||||||
|
|
||||||
// Get site environment from settings or use existing config
|
// Get site environment from settings or use existing config
|
||||||
const siteEnvSetting = allSettings.find(s => s.key === 'site_environment');
|
const siteEnvSetting = allSettings.find(s => s.key === 'site_environment');
|
||||||
|
|
|
||||||
|
|
@ -1,49 +1,58 @@
|
||||||
import { defineConfig } from 'vite';
|
import { defineConfig } from 'vite';
|
||||||
import react from '@vitejs/plugin-react';
|
import react from '@vitejs/plugin-react';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
import dotenv from 'dotenv';
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig(({mode}) => {
|
||||||
plugins: [react()],
|
// Load env variables
|
||||||
resolve: {
|
const env = loadEnv(mode, process.cwd(), '');
|
||||||
alias: {
|
|
||||||
'@': path.resolve(__dirname, 'src'),
|
// Determine HMR host based on environment
|
||||||
'@components': path.resolve(__dirname, 'src/components'),
|
const isProduction = process.env.ENVIRONMENT === "prod";
|
||||||
'@features': path.resolve(__dirname, 'src/features'),
|
const hmrHost = isProduction ? 'rocks.2many.ca' : 'localhost';
|
||||||
'@hooks': path.resolve(__dirname, 'src/hooks'),
|
const hmrConfig = isProduction
|
||||||
'@layouts': path.resolve(__dirname, 'src/layouts'),
|
? { host: hmrHost }
|
||||||
'@pages': path.resolve(__dirname, 'src/pages'),
|
: { host: hmrHost, clientPort: 3000 };
|
||||||
'@services': path.resolve(__dirname, 'src/services'),
|
return {
|
||||||
'@store': path.resolve(__dirname, 'src/store'),
|
plugins: [react()],
|
||||||
'@theme': path.resolve(__dirname, 'src/theme'),
|
resolve: {
|
||||||
'@utils': path.resolve(__dirname, 'src/utils'),
|
alias: {
|
||||||
'@assets': path.resolve(__dirname, 'src/assets')
|
'@': path.resolve(__dirname, 'src'),
|
||||||
}
|
'@components': path.resolve(__dirname, 'src/components'),
|
||||||
},
|
'@features': path.resolve(__dirname, 'src/features'),
|
||||||
server: {
|
'@hooks': path.resolve(__dirname, 'src/hooks'),
|
||||||
// port: 3000,
|
'@layouts': path.resolve(__dirname, 'src/layouts'),
|
||||||
// proxy: {
|
'@pages': path.resolve(__dirname, 'src/pages'),
|
||||||
// '/api': {
|
'@services': path.resolve(__dirname, 'src/services'),
|
||||||
// target: 'http://localhost:4000',
|
'@store': path.resolve(__dirname, 'src/store'),
|
||||||
// changeOrigin: true,
|
'@theme': path.resolve(__dirname, 'src/theme'),
|
||||||
// secure: false
|
'@utils': path.resolve(__dirname, 'src/utils'),
|
||||||
// }
|
'@assets': path.resolve(__dirname, 'src/assets')
|
||||||
// },
|
}
|
||||||
allowedHosts: ['localhost', 'rocks.2many.ca'],
|
|
||||||
host: '0.0.0.0',
|
|
||||||
port: 3000,
|
|
||||||
watch: {
|
|
||||||
usePolling: true,
|
|
||||||
},
|
},
|
||||||
hmr: {
|
server: {
|
||||||
clientPort: 3000,
|
// port: 3000,
|
||||||
host: 'localhost',
|
// proxy: {
|
||||||
|
// '/api': {
|
||||||
|
// target: 'http://localhost:4000',
|
||||||
|
// changeOrigin: true,
|
||||||
|
// secure: false
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
allowedHosts: ['localhost', 'rocks.2many.ca'],
|
||||||
|
host: '0.0.0.0',
|
||||||
|
port: 3000,
|
||||||
|
watch: {
|
||||||
|
usePolling: true,
|
||||||
|
},
|
||||||
|
hmr: hmrConfig
|
||||||
|
},
|
||||||
|
build: {
|
||||||
|
outDir: 'dist',
|
||||||
|
assetsDir: 'assets',
|
||||||
|
emptyOutDir: true,
|
||||||
|
sourcemap: process.env.NODE_ENV !== 'production'
|
||||||
}
|
}
|
||||||
},
|
|
||||||
build: {
|
|
||||||
outDir: 'dist',
|
|
||||||
assetsDir: 'assets',
|
|
||||||
emptyOutDir: true,
|
|
||||||
sourcemap: process.env.NODE_ENV !== 'production'
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Loading…
Reference in a new issue