Configuration File
Project Configuration File
/** @type {import('@scandipwa/magento-scripts').CMAConfiguration} */
module.exports = {
magento: {
first_name: 'Scandiweb',
last_name: 'Developer',
email: '[email protected]',
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 namelast_name- Admin last nameemail- Admin emailuser- Admin user namepasswordAdmin passwordadminuri- Admin panel URLmode- 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 using7.4.27.configTemplate-php.initemplate file location. With this option, you can define your ownphp.inifile that will be used by PHP. (Originalphp-template.inifile 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 is1.18.0configTemplate- Nginx template file location string. With this option, you can define your ownnginx.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 (Originalnginx.template.conffile can be found here)
/** @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 is8.0
/** @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 is7.6.2
/** @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 is6.0.10-alpine
/** @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
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.vcltemplate file location. With this option, you can define your ownvarnish.vclfile that will be used by Varnish. (Originalvarnish.template.vclfile can be found here)version- Varnish version string.
/** @type {import('@scandipwa/magento-scripts').CMAConfiguration} */
module.exports = {
magento: { ... },
configuration: {
varnish: {
// lets change composer version to 6.0
version: '6.0'
}
}
};SSL Terminator (Nginx)
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 is1.18.0configTemplate- SSL Terminator template file location string. With this option, you can define your ownssl-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 (Originalssl-terminator.template.conffile can be found here)
/** @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.
/** @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 (falseby 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'
}
};
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
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:
{
"useNonOverlappingPorts": false,
"analytics": true
}This configuration file contains the following configuration options:
Use Non-Overlapping Ports
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