Amauri Santos
Amauri Santos

Reputation: 129

Why don't I have environments and development inside config folder in my Strapi structure?

I'm following the strapi's documentation in order to deploy it to Heroku but I noticed that I don't have the same structure as in the example. It seems that I need to config both "Path: ./config/database.js" and "Path: ./config/env/development/database.js" to be able to deploy without any error.

This is what I have:

enter image description here

This is what I would like to have:

enter image description here

Before trying to deploy to Heroku I run npm run build. I'm new with fullstack development so I'm a little confused. Can anybody help me?

Upvotes: 0

Views: 607

Answers (1)

Derrick Mehaffy
Derrick Mehaffy

Reputation: 845

The entire config structure within Strapi changed with the release of the stable version (You can find the migration guide here: https://strapi.io/documentation/v3.x/migration-guide/migration-guide-beta.20-to-3.0.0.html )

All of the split files for each environment now have the ability to be called from the root of the config directory.

./config/environments/*/server.json => ./config/server.js OR ./config/env/*/server.js For this see: https://strapi.io/documentation/v3.x/concepts/configurations.html#server

Likewise for the database: ./config/environments/*/database.json => ./config/database.js OR ./config/env/*/database.js For this see: https://strapi.io/documentation/v3.x/concepts/configurations.html#database

The ./config/env/* folder structure is no longer required though you can use it if you like, with this new structure you can set a few base values in the default ./config/*.js and if you only need to change one key, you can place that change in the env folder. For more info on that refer to the following documentation: https://strapi.io/documentation/v3.x/concepts/configurations.html#environments

I've only provided links to the documentation as there is a lot of information to read (which the migration guide promotes that you should read the entirety of the new config documentation for this reason) and to lay out simple config examples really wouldn't be beneficial in this case.

You will find that outside resources relating to Strapi may not be up to date with this new config structure as it has only existed since the v3.x.x was released and it was a major breaking change.

Upvotes: 3

Related Questions