Craft configuration on fortrabbit¶
Craft 3 uses modern
.env style configuration, learn more about the concepts here. This means you can run your Craft locally and remotely without code or configuration file changes. Locally, your
.env file will be modified and read.
The mandatory Craft CMS security key has to be shared among all environments. We recommend to use your local security key as the master key. When you used Composer to install, that key was shown at the end of the installation. If not, open your local (hidden)
.env file from the root folder of your project and find a line that looks like this:
It will contain a value if you have installed Craft 3 correctly on your local machine. Copy that line. Go to the App's ENV vars settings in the Dashboard and paste that line. Here is the direct link:
That ENV var is already set. Just replace it with your local one. Also see the official Craft guide on that topic to learn about the different ways to create the key.
TLDR: No need to configure the MySQL database connection for fortrabbit, it should already be set. On fortrabbit the environment variables are seeded from the ones set in the Dashboard (not from the .env file). If you chose Craft in the Software Preset when creating the App, all ENV vars at fortrabbit will already be pre-populated. If not, see here.
Please include the following settings in the settings file located in
return [ 'siteUrl' => App::env('PRIMARY_SITE_URL') ?: '@web', ];
The file contains other settings as well: keep those. For more details and options, check out our Craft CMS tuning guide.