b3ross / dotenvi

A simple library for generating dotenv files
MIT License
17 stars 7 forks source link

Casing in resolver names #60

Closed samsch closed 3 years ago

samsch commented 4 years ago

Resolvers can only be lowercase.

default_env: &default_env
  SESSION_SECRET: ${randomString:32}

Can't work because randomString doesn't match:

const regex = new RegExp('\\${([a-z]+):(.*)}');

https://github.com/b3ross/dotenvi/blob/f42c0a16daf6ea38962d0377b7bb8b1862ed7ece/src/rewriter.ts#L28

I think just changing this to

const regex = new RegExp('\\${([a-zA-Z]+):(.*)}');

would at least allow for uppercase names. But maybe \w would be even better, to allow alphanumeric and underscores?

b3ross commented 4 years ago

Sure - easy enough fix. Feel free to throw in a PR.