Google Maps Bug
This commit is contained in:
@@ -16,7 +16,7 @@ This approach:
|
||||
|
||||
1. **Build Time**: Container is built WITHOUT secrets (no API keys in image)
|
||||
2. **Container Startup**:
|
||||
- `/app/load-config.sh` reads `/run/secrets/google-maps-api-key`
|
||||
- `/app/load-config.sh` reads `/run/secrets/google-maps-api-key` and `/run/secrets/google-maps-map-id`
|
||||
- Generates `/usr/share/nginx/html/config.js` with runtime values
|
||||
- Starts nginx
|
||||
3. **App Load Time**:
|
||||
@@ -86,6 +86,7 @@ fi
|
||||
cat > "$CONFIG_FILE" <<EOF
|
||||
window.CONFIG = {
|
||||
googleMapsApiKey: '$GOOGLE_MAPS_API_KEY',
|
||||
googleMapsMapId: '$GOOGLE_MAPS_MAP_ID',
|
||||
newApiKey: '$NEW_API_KEY'
|
||||
};
|
||||
EOF
|
||||
@@ -96,6 +97,7 @@ EOF
|
||||
```typescript
|
||||
export interface AppConfig {
|
||||
googleMapsApiKey: string;
|
||||
googleMapsMapId?: string;
|
||||
newApiKey: string; // Add new field
|
||||
}
|
||||
|
||||
@@ -108,6 +110,16 @@ export function getNewApiKey(): string {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
export function getGoogleMapsMapId(): string {
|
||||
try {
|
||||
const config = getConfig();
|
||||
return config.googleMapsMapId || '';
|
||||
} catch {
|
||||
console.warn('Google Maps Map ID not available.');
|
||||
return '';
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 3. Update docker-compose.yml
|
||||
@@ -116,6 +128,7 @@ export function getNewApiKey(): string {
|
||||
mvp-frontend:
|
||||
volumes:
|
||||
- ./secrets/app/google-maps-api-key.txt:/run/secrets/google-maps-api-key:ro
|
||||
- ./secrets/app/google-maps-map-id.txt:/run/secrets/google-maps-map-id:ro
|
||||
- ./secrets/app/new-api-key.txt:/run/secrets/new-api-key:ro # Add new secret
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user