Skip to content

Commit 7c5d420

Browse files
author
Manus AI
committed
fix: Update install command to create console environment files
This commit updates the install-fleetbase command to create/update the console environment files (.env.development and .env.production) before starting Docker containers. ## Changes - Create console/environments/.env.development with HTTP configuration - Create console/environments/.env.production with HTTPS configuration - Both files include API_HOST, SOCKETCLUSTER settings, and OSRM_HOST - Production file includes API_SECURE=true flag ## Rationale Production builds no longer use fleetbase.config.json for runtime configuration. Instead, they rely on .env.production files that are baked into the build. This ensures proper configuration for both development and production environments. ## Files Created 1. console/environments/.env.development - HTTP API endpoint - SOCKETCLUSTER_SECURE=false - Uses provided host value 2. console/environments/.env.production - HTTPS API endpoint - SOCKETCLUSTER_SECURE=true - API_SECURE=true - Uses provided host value This ensures that production builds have the correct configuration embedded at build time, while development continues to use runtime configuration via fleetbase.config.json.
1 parent 9a9c1a6 commit 7c5d420

1 file changed

Lines changed: 33 additions & 1 deletion

File tree

index.js

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ async function installFleetbaseCommand(options) {
818818
await fs.writeFile(overridePath, overrideContent);
819819
console.log('✔ docker-compose.override.yml created');
820820

821-
// Create console/fleetbase.config.json
821+
// Create console/fleetbase.config.json (for development runtime config)
822822
console.log('⏳ Creating console/fleetbase.config.json...');
823823
const configDir = path.join(directory, 'console');
824824
await fs.ensureDir(configDir);
@@ -832,6 +832,38 @@ async function installFleetbaseCommand(options) {
832832
await fs.writeJson(configPath, configContent, { spaces: 2 });
833833
console.log('✔ console/fleetbase.config.json created');
834834

835+
// Create/update console environment files (.env.development and .env.production)
836+
console.log('⏳ Updating console environment files...');
837+
const environmentsDir = path.join(configDir, 'environments');
838+
await fs.ensureDir(environmentsDir);
839+
840+
// Create .env.development
841+
const envDevelopmentContent = `API_HOST=http://${host}:8000
842+
API_NAMESPACE=int/v1
843+
SOCKETCLUSTER_PATH=/socketcluster/
844+
SOCKETCLUSTER_HOST=${host}
845+
SOCKETCLUSTER_SECURE=false
846+
SOCKETCLUSTER_PORT=38000
847+
OSRM_HOST=https://router.project-osrm.org
848+
`;
849+
const envDevelopmentPath = path.join(environmentsDir, '.env.development');
850+
await fs.writeFile(envDevelopmentPath, envDevelopmentContent);
851+
852+
// Create .env.production
853+
const envProductionContent = `API_HOST=https://${host}:8000
854+
API_NAMESPACE=int/v1
855+
API_SECURE=true
856+
SOCKETCLUSTER_PATH=/socketcluster/
857+
SOCKETCLUSTER_HOST=${host}
858+
SOCKETCLUSTER_SECURE=true
859+
SOCKETCLUSTER_PORT=38000
860+
OSRM_HOST=https://router.project-osrm.org
861+
`;
862+
const envProductionPath = path.join(environmentsDir, '.env.production');
863+
await fs.writeFile(envProductionPath, envProductionContent);
864+
865+
console.log('✔ Console environment files updated');
866+
835867
// Start Docker containers
836868
console.log('\n⏳ Starting Fleetbase containers...');
837869
console.log(' This may take a few minutes on first run...\n');

0 commit comments

Comments
 (0)