Configuration File

Project Configuration File

Since magento-scripts 1.2.0

default cma.js
/** @type {import('@scandipwa/magento-scripts').CMAConfiguration} */
module.exports = {
    magento: {
        first_name: 'Scandiweb',
        last_name: 'Developer',
        email: 'developer@scandipwa.com',
        user: 'admin',
        password: 'scandipwa123',
        adminuri: 'admin',
        mode: 'developer',
        edition: 'community'
    },
    configuration: {}
};

The configuration file is created when you start the project cma.js, it's a tool that allows you to be in control of important parts of the project without headaches.

Magento

Magento configuration is located in magento field and contains the following fields:

  • first_name - Admin first name

  • last_name - Admin last name

  • email - Admin email

  • user - Admin user name

  • password Admin password

  • adminuri - Admin panel URL

  • mode - Magento mode (description and list of available modes is located here)

  • edition - Magento edition. Allowed values: community, enterprise.

Services

In the field configuration we can configure PHP, Composer and Docker services.

PHP configuration

PHP configuration is located in the php field and contains the following fields:

  • version - PHP version, by default it is using 7.4.27.

  • configTemplate - php.ini template file location. With this option, you can define your own php.ini file that will be used by PHP. (Original php-template.ini file can be found here)

  • extensions - Map of extensions that will be used for the project. By default, it contains the following extensions that are required by Magento: gd, intl, zlib, openssl, sockets, SimpleXML, xdebug. You can add an extension that will be required by some Composer package, CMA will automatically install it with the correct version.

  • disabledExtensions - Array of strings as extension names. If for some reason you need to manually disable an extension in your setup, you can put its name in this option. Be careful as this could potentially break your setup.

/** @type {import('@scandipwa/magento-scripts').CMAConfiguration} */
module.exports = {
    magento: { ... },
    configuration: {
        php: {
            // lets change the default php version from 7.4.13 to 7.4.20
            version: '7.4.20',
            // and add some extensions
            extensions: {
                fileinfo: {},
                xdebug: {
                    version: '3.0.4'
                }
            }
        }
    }
};

Docker services configuration

Nginx

Nginx configuration is located in the nginx field and contains the following fields:

  • version - Container version string. For Nginx default version is 1.18.0

  • configTemplate - Nginx template file location string. With this option, you can define your own nginx.template.conf - File that will be copied inside the $CMA_CACHE/nginx/conf.d/ folder which is mounted in Nginx container to /etc/nginx/conf.d/ folder. string (Original nginx.template.conf file can be found here)

Nginx image is pulled from Docker Hub.

/** @type {import('@scandipwa/magento-scripts').CMAConfiguration} */
module.exports = {
    magento: { ... },
    configuration: {
        nginx: {
            // lets change nginx image version to 1.19
            version: '1.19.0',
            // and use custom nginx template
            configTemplate: './nginx.conf.template'
        }
    }
};

MySQL

MySQL configuration is located in the mysql field and contains the following fields:

  • version - Container version string. For MySQL default version is 8.0

MySQL image is pulled from Docker Hub.

/** @type {import('@scandipwa/magento-scripts').CMAConfiguration} */
module.exports = {
    magento: { ... },
    configuration: {
        mysql: {
            // lets change mysql image version to 8.0.25
            version: '8.0.25'
        }
    }
};

ElasticSearch

ElasticSearch configuration is located in the elasticsearch field and contains the following fields:

  • version - Container version string. For ElasticSearch default version is 7.6.2

ElasticSearch image is pulled from ElasticSearch Hub.

/** @type {import('@scandipwa/magento-scripts').CMAConfiguration} */
module.exports = {
    magento: { ... },
    configuration: {
        elasticsearch: {
            // lets change elasticsearch image version to 7.13.1
            version: '7.13.1'
        }
    }
};

Redis

Redis configuration is located in the redis field and contains the following fields:

  • version - Container version string. For Redis default version is 6.0.10-alpine

Redis image is pulled from Docker Hub.

/** @type {import('@scandipwa/magento-scripts').CMAConfiguration} */
module.exports = {
    magento: { ... },
    configuration: {
        redis: {
            // lets change redis image version to 6.2.4
            version: '6.2.4'
        }
    }
};

Composer

Composer configuration is located in the composer field and contains the following fields:

  • version - Composer version string.

/** @type {import('@scandipwa/magento-scripts').CMAConfiguration} */
module.exports = {
    magento: { ... },
    configuration: {
        composer: {
            // lets change composer version to 2.3.7
            version: '2.3.7'
        }
    }
};

Varnish

Since magento-scripts 1.15.0

Varnish configuration is located in the varnish field and contains the following fields:

  • enabled - A boolean option to manually enable or disable Varnish in the setup. (Default: false)

  • configTemplate - varnish.vcl template file location. With this option, you can define your own varnish.vcl file that will be used by Varnish. (Original varnish.template.vcl file can be found here)

  • version - Varnish version string.

Varnish image is pulled from Docker Hub.

/** @type {import('@scandipwa/magento-scripts').CMAConfiguration} */
module.exports = {
    magento: { ... },
    configuration: {
        varnish: {
            // lets change composer version to 6.0
            version: '6.0'
        }
    }
};

SSL Terminator (Nginx)

Since magento-scripts 1.15.0

SSL Terminator is an Nginx instance, it's configuration is located in sslTerminator field and contains the following fields:

  • version - Container version string. For Nginx default version is 1.18.0

  • configTemplate - SSL Terminator template file location string. With this option, you can define your own ssl-terminator.template.conf - File that will be copied inside the $CMA_CACHE/ssl-terminator/conf.d/ folder which is mounted in Nginx container to /etc/nginx/conf.d/ folder. string (Original ssl-terminator.template.conf file can be found here)

Nginx image is pulled from Docker Hub.

/** @type {import('@scandipwa/magento-scripts').CMAConfiguration} */
module.exports = {
    magento: { ... },
    configuration: {
        sslTerminator: {
            // lets change nginx image version to 1.19
            version: '1.19.0',
            // and use custom ssl-terminator nginx template
            configTemplate: './ssl-terminator.conf.template'
        }
    }
};

Domain

The host configuration is a string located in host field and by default, it is set to localhost . You can put your own host domain that will be set to nginx config as server_name and set Magento secure and unsecure base_url values.

Learn about adding a localhost domain to your application here.

/** @type {import('@scandipwa/magento-scripts').CMAConfiguration} */
module.exports = {
    magento: { ... },
    host: 'scandipwa.local'
};

SSL

SSL configuration is located in the ssl field and contains the following values:

  • enabled - Enables or disables SSL in the application. boolean (false by default)

  • ssl_certificate - SSL certificate file location string. You can put there your SSL certificate file location relative to the project root folder or use absolute value.

  • ssl_certificate_key - SSL certificate key file location string. You can put there your SSL certificate file location relatively to the project root folder or use absolute value.

/** @type {import('@scandipwa/magento-scripts').CMAConfiguration} */
module.exports = {
    magento: { ... },
    ssl: {
        enabled: true,
        ssl_certificate: './path/to/my/certificate',
        ssl_certificate_key: './path/to/my/certificate-key.pem'
    }
};

Learn about enabling SSL in your application here.

Prefix

Prefix configuration is a boolean located in the prefix field and by default, it is set to true .

But what prefixes are used for? Prefix is a unique identifier that will be appended to docker container and volume names to prevent possible interference between folders with similar names. (Interference between folders look like that) Setting prefix to false is generally not recommended but might be necessary for legacy projects.

/** @type {import('@scandipwa/magento-scripts').CMAConfiguration} */
module.exports = {
    magento: { ... },
    prefix: false
};

System Configuration FIle

Since magento-scripts 1.5.1

This configuration file is located in your home directory and should have a name .cmarc. As it is not created automatically, you will need to do it manually. The default configuration file looks like this:

$HOME/.cmarc
  {
    "useNonOverlappingPorts": false,
    "analytics": true
  }

This configuration file contains the following configuration options:

Use Non-Overlapping Ports

Recommended to enable this option if you are working with many CMA projects

Use non-overlapping ports is a feature that will tell CMA when choosing available ports on the system to also ignore ports that are already used by other CMA instances, even if they are stopped. That way it will ensure that your projects will not get new ports every time you switch between them.

To enable this feature, set useNonOverlappingPorts field in the system configuration file to true.

Analytics

Analytics help us to collect data about errors or possible slow-downs and help us to identify areas that should be fixed or improved!

Of course, you have an option to opt-out of analytic data collection. To do that set analytics field in the system configuration file to false and CMA will not collect analytic data from your system.

Last updated