I am at the very early stages of using CractCMS but I'm keen to get off to the correct start, writing notes as I go along etc but I cannot figure this issue out.
I have setup the Multi-Environment Configs to allow me to use, dev, staging and production sites, staging and production appear to work correctly but development site is causing issues.
I know it's something to do with the .env file and
ENVIRONMENT="production"
If I change that to
ENVIRONMENT="dev"
The development site will work.
What I can't understand is, both staging and production work so why not development?
I thought by using db.php and general.php I could do away with .env? Other than this line I can.
Here's my General.php code
<?php
return [
// Global settings
'*' => [
// Default Week Start Day (0 = Sunday, 1 = Monday...)
'defaultWeekStartDay' => 1,
// Enable CSRF Protection (recommended)
'enableCsrfProtection' => true,
// Whether "index.php" should be visible in URLs
'omitScriptNameInUrls' => true,
// Control Panel trigger word
'cpTrigger' => 'admin',
// The secure key Craft will use for hashing and encrypting data
'securityKey' => '*******************************',
],
// Dev environment settings
'dev' => [
// Base site URL
'siteUrl' => null,
'basePath' => '@webroot/cpresources',
'baseUrl' => 'https://mydomain.test',
],
// Staging environment settings
'staging' => [
// Base site URL
'siteUrl' => null,
'basePath' => '@webroot/cpresources',
'baseUrl' => 'https://staging.mydomain.co.uk',
],
// Production environment settings
'production' => [
// Base site URL
'siteUrl' => null,
'basePath' => '@webroot/cpresources',
'baseUrl' => 'https://mydomain.co.uk',
],
];
Here's my db.php code
<?php
return array(
'*' => array(
'tablePrefix' => '',
'driver' => 'mysql',
'schema' => 'public',
),
'dev' => [
// Base site URL
'server' => 'localhost',
'user' => 'myusername',
'password' => '*************',
'database' => 'mydatabasename',
],
'staging' => array(
'server' => 'localhost',
'user' => 'myusername',
'password' => '*************',
'database' => 'craft_cms_staging',
),
'production' => array(
'server' => 'localhost',
'user' => 'myusername',
'password' => '*',
'database' => 'craft_cms_production',
),
);
Now before anyone says anything about uploading db.php and general.php to git etc because of passwords, I have put both these files in the .gitignore file. I felt this was the best option but if I'm wrong, please explain?