Last active
December 5, 2020 17:58
-
-
Save ademers/2b2933470a3b1ef63bcffe75118a8f15 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Yii Application Config | |
* | |
* Edit this file at your own risk! | |
* | |
* The array returned by this file will get merged with | |
* vendor/craftcms/cms/src/config/app.php and app.[web|console].php, when | |
* Craft's bootstrap script is defining the configuration for the entire | |
* application. | |
* | |
* You can define custom modules and system components, and even override the | |
* built-in system components. | |
* | |
* If you want to modify the application config for *only* web requests or | |
* *only* console requests, create an app.web.php or app.console.php file in | |
* your config/ folder, alongside this one. | |
*/ | |
use craft\helpers\App; | |
return [ | |
'*' => [ | |
'id' => App::env('APP_ID') ?: 'CraftCMS', | |
'modules' => [ | |
'my-module' => \modules\Module::class, | |
'site-module' => [ | |
'class' => \modules\sitemodule\SiteModule::class, | |
], | |
], | |
'bootstrap' => ['site-module'], | |
], | |
'production' => [ | |
'components' => [ | |
// Mailgun | |
'mailer' => function() { | |
// Get the stored email settings | |
$settings = craft\helpers\App::mailSettings(); | |
// Override the transport adapter class | |
$settings->transportType = craft\mailgun\MailgunAdapter::class; | |
// Override the transport adapter settings | |
$settings->transportSettings = [ | |
'domain' => getenv('MAILGUN_DOMAIN'), | |
'apiKey' => getenv('MAILGUN_API_KEY'), | |
]; | |
// Create a Mailer component config with these settings | |
$config = craft\helpers\App::mailerConfig($settings); | |
// Instantiate and return it | |
return Craft::createObject($config); | |
}, | |
] | |
], | |
'dev' => [ | |
'components' => [ | |
// Mailhog in Laravel Homestead | |
'mailer' => function() { | |
// Get the stored email settings | |
$settings = craft\helpers\App::mailSettings(); | |
// Override the transport adapter class | |
$settings->transportType = \craft\mail\transportadapters\Smtp::class; | |
// Override the transport adapter settings | |
$settings->transportSettings = [ | |
'host' => getenv('MAIL_HOST'), | |
'port' => getenv('MAIL_PORT'), | |
'useAuthentication' => false, | |
'username' => getenv('MAIL_USERNAME'), | |
'password' => getenv('MAIL_PASSWORD'), | |
]; | |
// Create a Mailer component config with these settings | |
$config = craft\helpers\App::mailerConfig($settings); | |
// Instantiate and return it | |
return Craft::createObject($config); | |
}, | |
] | |
], | |
]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment