DEV Community

Discussion on: I am the author of Elm in Action. Ask Me Anything!

Collapse
 
rtfeldman profile image
Richard Feldman

Yeah, for API keys I recommend creating something like Secrets.elm and adding that file to .gitignore. Locally, developers have to create that file as part of setting up their systems, and then you have your build process swap in a different file (containing different constants) for production builds.

This way you can easily access the secrets from any module, and if you forget to set them up locally, you'll get a compile error because the module won't be found!

I do this with the Frontend Masters workshop for GitHub API access tokens; you can check out the repo here github.com/rtfeldman/elm-workshop