Redesign
This commit is contained in:
@@ -16,7 +16,6 @@ const configSchema = z.object({
|
||||
name: z.string(),
|
||||
port: z.number(),
|
||||
environment: z.string(),
|
||||
tenant_id: z.string(),
|
||||
node_env: z.string(),
|
||||
}),
|
||||
|
||||
@@ -49,19 +48,9 @@ const configSchema = z.object({
|
||||
url: z.string(),
|
||||
timeout: z.string(),
|
||||
}),
|
||||
tenants: z.object({
|
||||
url: z.string(),
|
||||
timeout: z.string(),
|
||||
}),
|
||||
}),
|
||||
}),
|
||||
|
||||
// MinIO configuration
|
||||
minio: z.object({
|
||||
endpoint: z.string(),
|
||||
port: z.number(),
|
||||
bucket: z.string(),
|
||||
}),
|
||||
|
||||
// External APIs configuration
|
||||
external: z.object({
|
||||
@@ -85,7 +74,6 @@ const configSchema = z.object({
|
||||
|
||||
// Frontend configuration
|
||||
frontend: z.object({
|
||||
tenant_id: z.string(),
|
||||
api_base_url: z.string(),
|
||||
auth0: z.object({
|
||||
domain: z.string(),
|
||||
@@ -144,9 +132,6 @@ const configSchema = z.object({
|
||||
// Secrets schema definition
|
||||
const secretsSchema = z.object({
|
||||
postgres_password: z.string(),
|
||||
minio_access_key: z.string(),
|
||||
minio_secret_key: z.string(),
|
||||
platform_vehicles_api_key: z.string(),
|
||||
auth0_client_secret: z.string(),
|
||||
google_maps_api_key: z.string(),
|
||||
});
|
||||
@@ -162,8 +147,7 @@ export interface AppConfiguration {
|
||||
getDatabaseUrl(): string;
|
||||
getRedisUrl(): string;
|
||||
getAuth0Config(): { domain: string; audience: string; clientSecret: string };
|
||||
getPlatformServiceConfig(service: 'vehicles' | 'tenants'): { url: string; apiKey: string };
|
||||
getMinioConfig(): { endpoint: string; port: number; accessKey: string; secretKey: string; bucket: string };
|
||||
getPlatformVehiclesUrl(): string;
|
||||
}
|
||||
|
||||
class ConfigurationLoader {
|
||||
@@ -197,9 +181,6 @@ class ConfigurationLoader {
|
||||
|
||||
const secretFiles = [
|
||||
'postgres-password',
|
||||
'minio-access-key',
|
||||
'minio-secret-key',
|
||||
'platform-vehicles-api-key',
|
||||
'auth0-client-secret',
|
||||
'google-maps-api-key',
|
||||
];
|
||||
@@ -257,24 +238,8 @@ class ConfigurationLoader {
|
||||
};
|
||||
},
|
||||
|
||||
getPlatformServiceConfig(service: 'vehicles' | 'tenants') {
|
||||
const serviceConfig = config.platform.services[service];
|
||||
const apiKey = service === 'vehicles' ? secrets.platform_vehicles_api_key : 'mvp-platform-tenants-secret-key';
|
||||
|
||||
return {
|
||||
url: serviceConfig.url,
|
||||
apiKey,
|
||||
};
|
||||
},
|
||||
|
||||
getMinioConfig() {
|
||||
return {
|
||||
endpoint: config.minio.endpoint,
|
||||
port: config.minio.port,
|
||||
accessKey: secrets.minio_access_key,
|
||||
secretKey: secrets.minio_secret_key,
|
||||
bucket: config.minio.bucket,
|
||||
};
|
||||
getPlatformVehiclesUrl(): string {
|
||||
return config.platform.services.vehicles.url;
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user