0

I'm new to sails and nodejs, and trying to figure out how best to handle configuration, particularly in usage with Docker. It's been suggested to me that I maintain a separate folder with all the config files outside of the Sails application that Sails will read from before starting up the application.

Based on what I understand about Sails, I would want to bootstrap a method that would copy the config files (using fs?) from a outside directory that I store the configuration.

Is there a better way to do this?

Thanks.

2 Answers 2

1

There is a config folder generated by sails when you start a new project, isn't it a good place to store your config ?

If you use git and don't want your config to be versioned, by default, config/local.js is in the .gitignore.

Otherwise, using config/bootstrap.js you can perform actions before the app lifts, such as copying config files over.

Beware, though, that the filepath you use will end up in your VCS, unless you put them in the local.js

Sign up to request clarification or add additional context in comments.

3 Comments

I plan to use Docker to host an instance of the node app. I'm still trying to figure out how I want the configuration to work. Thanks for your input! I'll reply again later once I figure it out.
I've never used Docker so I can't help you with that.
+1 thanks for providing input. I came up with the solution that I've now posted. I've also edited my question to better ask the question I was trying to ask.
0

For use with Docker, I used the following model:

Before loading config, check if environment variable exists (process.env.VARIABLE), if not, read from sails config file.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.