Expand env heuristics from common examples
All checks were successful
Build Windows App / build-windows (push) Successful in 16m37s

This commit is contained in:
MrSphay
2026-05-01 23:32:35 +02:00
parent 5ad22b86bf
commit c7711096ea
2 changed files with 173 additions and 1 deletions

View File

@@ -329,10 +329,26 @@ function inferDefaultValue(key: string, value: string): string | null {
const isEmpty = value.length === 0;
const shouldFillGeneric = hasPlaceholder || isEmpty;
if (signal === "APP_ENV" || signal === "RAILS_ENV") {
return "production";
}
if (signal === "NODE_ENV") {
return "production";
}
if (signal.includes("LOG_LEVEL")) {
return "info";
}
if (signal.includes("TELEMETRY_ENABLED") || signal.includes("PROMETHEUS_METRICS") || signal.includes("METRICS_ENABLED")) {
return "false";
}
if (signal.includes("CORS_CREDENTIALS") || signal.includes("USE_SSL") || signal.includes("REQUIRE_SSL")) {
return "true";
}
if (signal.includes("BOOTSTRAP_ADMIN_EMAIL") || signal.includes("ADMIN_EMAIL")) {
return "admin@example.local";
}
@@ -349,10 +365,50 @@ function inferDefaultValue(key: string, value: string): string | null {
return "admin@example.local";
}
if (shouldFillGeneric && (signal.includes("BASE_URL") || signal.endsWith("_URL") || signal.endsWith("_URI") || signal.includes("ORIGIN"))) {
if (shouldFillGeneric && (signal.includes("BASE_URL") || signal.endsWith("_URL") || signal.endsWith("_URI") || signal.includes("ORIGIN") || signal.includes("SITE_URL"))) {
return "https://example.local";
}
if (shouldFillGeneric && signal.includes("CORS_ORIGIN")) {
return "https://example.local";
}
if (shouldFillGeneric && signal.includes("SMTP_HOST")) {
return "smtp.example.local";
}
if (shouldFillGeneric && signal.includes("SMTP_PORT")) {
return "587";
}
if (shouldFillGeneric && signal.includes("SMTP_USER")) {
return "smtp-user";
}
if (shouldFillGeneric && (signal.includes("SMTP_FROM") || signal.includes("MAIL_FROM") || signal.includes("SENDER_EMAIL"))) {
return "noreply@example.local";
}
if (shouldFillGeneric && (signal.includes("S3_BUCKET") || signal.includes("BUCKET_NAME"))) {
return "app-bucket";
}
if (shouldFillGeneric && (signal.includes("S3_REGION") || signal.includes("AWS_REGION") || signal.includes("SQS_REGION"))) {
return "eu-central-1";
}
if (shouldFillGeneric && signal.includes("S3_ENDPOINT")) {
return "https://s3.example.local";
}
if (shouldFillGeneric && signal.includes("RABBITMQ_URI")) {
return "amqp://rabbitmq:5672";
}
if (shouldFillGeneric && signal.includes("REDIS_URL")) {
return "redis://redis:6379/0";
}
if (shouldFillGeneric && signal.includes("PORT")) {
if (signal.includes("POSTGRES")) {
return "5432";
@@ -362,6 +418,14 @@ function inferDefaultValue(key: string, value: string): string | null {
return "6379";
}
if (signal.includes("SMTP")) {
return "587";
}
if (signal.includes("S3") || signal.includes("MINIO")) {
return "9000";
}
return "3000";
}