railwayapp/cli

[FEATURE REQUEST] make `shell` respect local .env files (configurable with flag overrides)

alexng353 opened this issue · 2 comments

proposal:
allow shell users to override/supplement railway variables with local .env's

features:

  • flags
    • --envfile={path} env file to use, defaults to these, in this order: railway.env, .env.local, .local.env, .env
    • --prefer-remote override namespace collisions with railway variables
    • --prefer-local override namespace collisions with local variables
  • can consume JSON formatted files (single level depth)
  • can consome kv formatted files (default .env styling)

defaults to prefer remote if there are namespace collisions without a prefer specified
respecting local .env files is disabled by default

What's the motivation behind this? I'm curious about the purpose of this as railway shell is meant for spawning a shell with (remote) Railway variables - is there a use case for wanting local variables inside the shell?

namespace collisions

Can you elaborate on this bit?

namespace collisions

Can you elaborate on this bit?

Sorry for the late reply, but I meant handling what happens when both railway and the local .env file have name collisions.

i.e. railway has API_KEY="hi james" and .env.local has API_KEY="hi john" there could be flags that change how the collisions are rectified