Skip to content

Commit

Permalink
feat: Add mail settings
Browse files Browse the repository at this point in the history
  • Loading branch information
poppabear8883 committed Aug 6, 2018
1 parent d97a114 commit 92afd9b
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 11 deletions.
8 changes: 8 additions & 0 deletions src/Configs/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@
'dbpass' => '',
'dbrootpass' => '',

/* Mail */
'mail_driver' => 'smtp',
'mail_host' => '',
'mail_port' => '',
'mail_username' => '',
'mail_password' => '',
'mail_from_name' => '',

/* Chat */
'echo-port' => '',
'echo-protocol' => '',
Expand Down
49 changes: 46 additions & 3 deletions src/Installer/Server/ServerSetup.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ public function handle()

$this->database();

$this->mail();

$this->chat();

$this->apiKeys();
Expand All @@ -34,8 +36,8 @@ protected function server()
$this->warning("Invalid Format:");
$this->io->writeln("<fg=blue>Must be a fully qualified domain name. Examples:</>");
$this->io->listing([
fqdn().'.com',
'server.'.fqdn().'.com',
fqdn() . '.com',
'server.' . fqdn() . '.com',
'example.com',
'server.example.com',
'localhost'
Expand Down Expand Up @@ -65,7 +67,7 @@ protected function user()
$dbpass = $this->question('Owner Password', '');
$this->config->app('password', $dbpass);

$default = 'admin@'.$this->config->app('hostname');
$default = 'admin@' . $this->config->app('hostname');
$email = $this->question('Owner Email', $default);
$this->config->app('owner_email', trim($email));
}
Expand Down Expand Up @@ -131,4 +133,45 @@ protected function apiKeys()
$key = $this->question('OMDB Key', '');
$this->config->app('omdb-key', $key);
}

protected function mail()
{
$this->io->writeln('<fg=blue>Mail Settings</>');
$this->io->writeln('(Used for things like invites, registration, ect.)');
$this->seperator();

$this->io->writeln('<fg=blue>/* You will need a provider like torguard. */</>');
$this->io->writeln('<fg=cyan>https://torguard.net/anonymous-email.php</>');

$this->io->writeln('Ref: <fg=cyan>https://laravel.com/docs/5.6/mail#introduction</>');

$value = $this->io->choice('Mail Driver', [
"smtp",
"sendmail",
"mailgun",
"mandrill",
"ses",
"sparkpost",
"log",
"array"
], 'smtp');

$this->config->app('mail_driver', $value);

$value = $this->question('Mail Host', '');
$this->config->app('mail_host', $value);

$value = $this->question('Mail Port', '');
$this->config->app('mail_port', $value);

$value = $this->question('Mail Username', '');
$this->config->app('mail_username', $value);

$value = $this->question('Mail Password', '');
$this->config->app('mail_password', $value);

$value = $this->question('Mail From Name', '');
$this->config->app('mail_from_name', $value);

}
}
9 changes: 8 additions & 1 deletion src/Installer/UNIT3D/Unit3dSetup.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ protected function env()
'{{OWNERPASSWORD}}' => $this->config->app('password'),
'{{TMDBAPIKEY}}' => $this->config->app('tmdb-key'),
'{{OMDBAPIKEY}}' => $this->config->app('omdb-key'),
'{{MAILDRIVER}}' => $this->config->app('mail_driver'),
'{{MAILHOST}}' => $this->config->app('mail_host'),
'{{MAILPORT}}' => $this->config->app('mail_port'),
'{{MAILUSERNAME}}' => $this->config->app('mail_username'),
'{{MAILPASSWORD}}' => $this->config->app('mail_password'),
'{{MAILFROMNAME}}' => $this->config->app('mail_from_name')
],
'../.env.stub',
"$install_dir/.env"
Expand Down Expand Up @@ -123,12 +129,13 @@ protected function setup()
'npm run prod',
'php artisan key:generate',
'php artisan migrate --seed',
'php artisan test:email'
];

foreach ($www_cmds as $cmd) {
$this->process([
"su $web_user -s /bin/bash --command=\"cd $install_dir && $cmd\""
]);
], true);
}

$this->io->writeln(' ');
Expand Down
14 changes: 7 additions & 7 deletions src/Resources/.env.stub
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ REDIS_PORT=6379
REDIS_DEFAULT_DB=0
REDIS_SESSION_DB=1

MAIL_DRIVER=smtp
MAIL_HOST=stealth.tg
MAIL_PORT=587
MAIL_USERNAME=[email protected]
MAIL_PASSWORD=mypassword
MAIL_DRIVER={{MAILDRIVER}}
MAIL_HOST={{MAILHOST}}
MAIL_PORT={{MAILPORT}}
MAIL_USERNAME={{MAILUSERNAME}}
MAIL_PASSWORD={{MAILPASSWORD}}
MAIL_ENCRYPTION=TLS
MAIL_FROM_NAME=SITENAMEHERE
MAIL_FROM_ADDRESS=[email protected]
MAIL_FROM_NAME={{MAILFROMNAME}}
MAIL_FROM_ADDRESS={{MAILUSERNAME}}

DEFAULT_OWNER_NAME={{OWNER}}
DEFAULT_OWNER_EMAIL={{OWNEREMAIL}}
Expand Down

0 comments on commit 92afd9b

Please sign in to comment.