flemay / envvars

Give your environment variables the love they deserve.
MIT License
20 stars 4 forks source link

List of examples #2

Closed aarongorka closed 3 years ago

aarongorka commented 5 years ago

It would be nice to pass a list of examples instead of being limited to one.

envvars:
  - name: ENV
    description: Application environment
    examples:
      - prod
      - dev
    tags:
      - deploy
flemay commented 5 years ago

Currently it would not be possible. example can be passed to the command envfile which generates a .env file with the example values. :) https://github.com/flemay/envvars/blob/master/cmd/envfile.go#L32

flemay commented 5 years ago

What I think would be best is to have a list of accepted values. What do you think @aarongorka ?

aarongorka commented 5 years ago

My example is probably not very good, I was thinking more of very dissimilar examples but not necessarily a list of accepted values. An application I am working with accepts both files and directories as input so I wanted to have both dir/file.yml and dir/ as examples.

Some options I thought of;

  1. Generate the .env.example from the 1st item in the examples list (too unintuitive/magic)
  2. Have two separate fields (example and examples? default and examples?)
  3. Just put my examples in the desc field

If 2. is not a good idea I will just do 3. and we can close this issue.

flemay commented 5 years ago
  1. Too magic hehe
  2. default would be confusing as in people may think that it would be that value if none is provided whereas I use example values to generate .env file only if you pass example. and having example along with examples will be confusing too because both will be for different purpose while 1 being just the plural of the other.
  3. desc would be a good place where to start.

That being said, wonder if there is another way to generate the example or maybe generating the example file is not required?