You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature Request] Detect Fly.io in builtin platform detection #1142
Detect Fly.io in the builtin platform detection (@varlock/ci-env-info), so VARLOCK_PLATFORM is set on Fly Machines and VARLOCK_ENV does not fall back to development there.
Motivation
Fly.io is a common host for long-running apps, and varlock run -- <app> is the documented way to run one there. Today nothing detects it (there is no Fly entry in packages/ci-env-info/src/platforms.ts), so on a Fly Machine VARLOCK_ENV takes the local fallback and resolves to development. A schema using @currentEnv=$VARLOCK_ENV, or deriving its own flag from it as the builtin variables docs suggest, then loads development config in production unless the flag is set explicitly in the image or fly.toml. Nothing warns about it.
Proposed Solution
Add a platform entry for Fly, next to Railway and Render:
detect: FLY_APP_NAME together with FLY_MACHINE_ID (both set on every Machine, see runtime environment).
name: Fly.io, so VARLOCK_PLATFORM reports it; not a CI platform, so VARLOCK_IS_CI stays false.
VARLOCK_ENV: Fly has no environment concept of its own, so either map a detected Machine to production, or leave it unset and have varlock warn when a known hosting platform is detected with no environment mapping, instead of silently using development.
Other fields where Fly provides them, e.g. FLY_IMAGE_REF for a build or deploy identifier.
Alternatives
Set the environment flag explicitly in the Dockerfile or fly.toml (what we do now). It works, but the silent development fallback is easy to miss.
A general warning when VARLOCK_ENV falls back to development inside a container with no platform detected.
Additional Information
Found while deploying a Bun app to Fly under varlock run with a flag derived from $VARLOCK_ENV.
Detection itself is small: a platform entry matching FLY_APP_NAME together with FLY_MACHINE_ID, reporting Fly.io with ci: false. Fly doesn't expose git metadata or a deploy-level ID, so there are no other fields to extract. I have it ready with a test and a docs line, but on its own it only sets VARLOCK_PLATFORM, and VARLOCK_ENV still falls back to development. So the useful part is the VARLOCK_ENV behaviour:
Map a detected Machine to production. It's simple, but it's wrong for a staging app on Fly unless the user overrides it.
Leave it unmapped, and warn when a known hosting platform is detected without an environment mapping.
Happy to send the PR once you've picked one (or neither). In the meantime, keying off the platform works: APP_ENV=if(eq($VARLOCK_PLATFORM, "Fly.io"), production, $VARLOCK_ENV).
✅ A fix has been merged to main in #1167 and will ship in the next release. GitHub auto-closed this issue on merge, but the change isn't published yet.
Activity
pullfrog commentedon Sep 28, 2026
timche commentedon Sep 28, 2026
Detection itself is small: a platform entry matching
FLY_APP_NAMEtogether withFLY_MACHINE_ID, reportingFly.iowithci: false. Fly doesn't expose git metadata or a deploy-level ID, so there are no other fields to extract. I have it ready with a test and a docs line, but on its own it only setsVARLOCK_PLATFORM, andVARLOCK_ENVstill falls back todevelopment. So the useful part is theVARLOCK_ENVbehaviour:production. It's simple, but it's wrong for a staging app on Fly unless the user overrides it.Happy to send the PR once you've picked one (or neither). In the meantime, keying off the platform works:
APP_ENV=if(eq($VARLOCK_PLATFORM, "Fly.io"), production, $VARLOCK_ENV).github-actions commentedon Sep 30, 2026
✅ A fix has been merged to
mainin #1167 and will ship in the next release. GitHub auto-closed this issue on merge, but the change isn't published yet.