config/local.js
fileThe config/local.js
file is useful for configuring a Sails app for your local environment (your laptop, for example). The settings in this file take precedence over all other config files except .sailsrc. Since they're intended only for local use, they should not be put under version control (and are included in the default .gitignore
file for that reason). Use local.js
to store local database settings, change the port used when lifting an app on your computer, etc.
While you’re developing your app, this config file should include any settings specifically for your development computer or server (db passwords, etc.) If you're using git, note that config/local.js
is included in the .gitignore
in new Sails apps by default, and so it won't be checked into your repository when you commit.
When you’re ready to deploy your app in production, you can also use this file for configuration options on the server where it will be deployed. However, for server deployments, environment variables are usually preferable. You can also use command-line arguments and the .sailsrc
file as alternatives to config/local.js
for your local development configuration. See the overview for general information about Sails configuration.
Note: This file is included in your .gitignore, so if you’re using git as a version control solution for your Sails app, keep in mind that this file won’t be committed to your repository! Good news is, that means you can specify configuration for your local machine in this file without inadvertently committing personal information (like database passwords) to the repo. Plus, this prevents other members of your team from commiting their local configuration changes on top of yours.