getsops / sops

Simple and flexible tool for managing secrets
https://getsops.io/
Mozilla Public License 2.0
16.58k stars 865 forks source link

feat: follow best practices with regards to naming .env files #1513

Open DrakeEvans opened 4 months ago

DrakeEvans commented 4 months ago

Many libraries and dev tools use .env files. Typically different files are used for different environments like dev, staging, and production. Typically, these are named .env.production with the designation happening after the .env.

This change allows sops to recognize dotenv files named with .env at the beginning of the filename in addition to the suffix (current functionality)

felixfontein commented 4 months ago

Thanks for your contribution! This is unfortunately a breaking change, see https://github.com/getsops/sops/pull/1450#issuecomment-1978049930 for details.

DrakeEvans commented 4 months ago

@felixfontein I can re-implement as non-breaking by ensuring that the prefix has the lowest precedence when determining filetype.

felixfontein commented 4 months ago

@DrakeEvans it's always a breaking space, since it affects how SOPS identifies the type of some files. It will suddenly use the env store instead of the binary store for some files.

felixfontein commented 4 months ago

(A possible solution would be to embed - if asked to - the original store type in the encrypted file, so SOPS doesn't have to guess it when decrypting. The 'if asked to' part here is important since otherwise it's also breaking backwards compatibility. But that's a more complex change that first needs some discussion...)

DrakeEvans commented 4 months ago

Yeah Im wondering if its easier to just specify the input-type/output-type in the config file. Does that functionality already exist?

felixfontein commented 4 months ago

I don't think it exists so far.