strapi-tool-dockerize icon indicating copy to clipboard operation
strapi-tool-dockerize copied to clipboard

What is the reason of env folder?

Open alimoli opened this issue 1 year ago • 1 comments

Feature Request

I am trying to understand what is the purpose of having an /env folder that emulates the configuration already present in Strapi. Example of config/database.ts:

postgres: {
      connection: {
        connectionString: env('DATABASE_URL'),
        host: env('DATABASE_HOST', 'localhost'),
        port: env.int('DATABASE_PORT', 5432),
        database: env('DATABASE_NAME', 'strapi'),
        user: env('DATABASE_USERNAME', 'strapi'),
        password: env('DATABASE_PASSWORD', 'strapi'),
        ssl: env.bool('DATABASE_SSL', false) && {
          key: env('DATABASE_SSL_KEY', undefined),
          cert: env('DATABASE_SSL_CERT', undefined),
          ca: env('DATABASE_SSL_CA', undefined),
          capath: env('DATABASE_SSL_CAPATH', undefined),
          cipher: env('DATABASE_SSL_CIPHER', undefined),
          rejectUnauthorized: env.bool(
            'DATABASE_SSL_REJECT_UNAUTHORIZED',
            true
          ),
        },
        schema: env('DATABASE_SCHEMA', 'public'),
      },
      pool: { min: env.int('DATABASE_POOL_MIN', 2), max: env.int('DATABASE_POOL_MAX', 10) },
    },

My env/database.ts:

export default ({env}) => ({
  connection: {
    client: 'postgres',
    connection: {
      host: env('DATABASE_HOST', undefined),
      port: env.int('DATABASE_PORT', undefined),
      database: env('DATABASE_NAME', undefined),
      user: env('DATABASE_USERNAME', undefined),
      password: env('DATABASE_PASSWORD', undefined),
      ssl: env.bool('DATABASE_SSL', false) && {
        rejectUnauthorized: false
      }
    }
  }
});

Another related question, how does it behave this plugin in case of plugins (f.e. cloudinary)?

alimoli avatar Dec 17 '23 11:12 alimoli

It's using the cold configuration of strapi and should be updated soon as I'm writing V2. The idea with the old one was to overwrite the .env More info found here https://docs.strapi.io/dev-docs/configurations/environment/#environment-configurations

Eventyret avatar Mar 14 '24 17:03 Eventyret

It's using the cold configuration of strapi and should be updated soon as I'm writing V2. The idea with the old one was to overwrite the .env More info found here https://docs.strapi.io/dev-docs/configurations/environment/#environment-configurations

URL link is broken.

HeisUser avatar Apr 06 '25 09:04 HeisUser