sops icon indicating copy to clipboard operation
sops copied to clipboard

SOPS should recogonize .env.* files as DOTENV filetype

Open jaymefSO opened this issue 5 years ago • 4 comments

When using something such as dotenv-flow in react/node projects you can load various environments in env files named for example .env.development, .env.stage etc.

SOPS will recognize .env and filename.env as a DOTENV file but not .env.something. Is there a way to make sops treat files prefixed with .env.* as DOTENV filetype without having to specify input/output type on command line every time?

jaymefSO avatar Aug 27 '20 12:08 jaymefSO

I don't think we should do this, there's too many open questions. What if it's called .env.yaml?

SOPS uses the extension, and if that fails, you can use a flag. I believe that's enough. If spelling the flag out every time is too repetitive, creating a shell alias takes about a minute.

autrilla avatar Aug 27 '20 16:08 autrilla

Having the extension list be configurable, or even a regex, would be nice, but I'm not sure the complexity is worth it.

autrilla avatar Aug 27 '20 16:08 autrilla

An extension list would be nice, or if possible to configure regex in .sops.yaml -- this is more of a feature request but would be a good addition IMO. As said, I'm not sure how complex the addition would be and if worth it in the end.

jaymefSO avatar Aug 27 '20 16:08 jaymefSO

Does specifying the input and output type solve it?

For me this works:

$ sops --input-type=dotenv --output-type=dotenv -i .env.prod
creation_rules:
  - path_regex: \.env\.prod$
    kms: 'arn:aws:kms:us-east-1:123:key/my-key'

ruudk avatar Sep 08 '23 13:09 ruudk