Every application needs some amount of configuration. That’s one of the more obvious sentences I’ve ever written, but it’s true! And it can be a little bit of a pain to manage that configuration, especially in Angular applications. At least that’s what I thought until recently.
A little while ago I was listening to the Adventures in Angular podcast where they spoke about ways to store that configuration. It was very enlightening, and I definitely encourage listening to that and reading Dave Bush’s accompanying blog post on the subject. One of the things I learned that was surprising to me was that the environment files are not the place to store application configuration. I thought it was, and that’s what I’d been using it for. I didn’t love the practice of doing that, though, because every time I needed to make even a small change to the config, I had to rebuild the applicaiton and do a new deploy. On my Node backend apps, I could provide configuration as runtime arguments, which allowed me to change configuration easily whenever I wanted. I wanted that same thing for my Angular apps. I was happy to learn there’s a way to do that!
I’m not going to talk about that today though, I’m gonna save that for another time. Today I want to talk about one of the options mentioned in that podcast episode for managing the application configuration you have. One option was by managing a JSON file that you’d put on each server. Another way was storing it in a database, with a lightweight application that allowed you to edit those configurations. So I decided to build one. That’s what I wanted to release today: a GitHub repo with a starting point for a project that does just that. The application allows you to add multiple applications, with multiple environment in each application, and as many key/value pairs as you want for the configuration. (Sidenote: there is no backend application provided right now. You can make adjustments after you fork the code to hook it up to your favorite backend. There’s also no authentication provided; you’ll have to do that as well.)
There’s still work to do; documentation (although you should be able to get started without too much documentation for now), testing, bug fixes, etc. are sure to be needed, but I’m going to continue working on it and working out some of those wrinkles. If you can help with any of those things, or want to, send a PR; I’d love to have your help!
Hopefully this helps you out, and provides a way for you to save some time in configuring your application in a more manageable way, and a better-practice way than storing everything in the environments files. Please reach out with any input or questions, I’d love to hear anything you have to say!