Browse Source

Update Email Configuration file

added a template to parametrize the email configuration sending
process

Change-Id: If640f30f569a77461ba396f07fd07aad1f356587
Sebastian Marcet 3 years ago
parent
commit
0bd2988d1c
2 changed files with 141 additions and 1 deletions
  1. 17
    1
      manifests/init.pp
  2. 124
    0
      templates/mail.php.erb

+ 17
- 1
manifests/init.pp View File

@@ -54,7 +54,12 @@ class openstackid (
54 54
   $app_url = '',
55 55
   $app_key = '',
56 56
   $app_version = '',
57
-  $app_timezone = 'UTC'
57
+  $app_timezone = 'UTC',
58
+  $email_driver = 'mail',
59
+  $email_smtp_server = 'smtp.mailgun.org',
60
+  $email_smtp_server_port = 587,
61
+  $email_smtp_server_user = '',
62
+  $email_smtp_server_password = '',
58 63
 ) {
59 64
 
60 65
   # php packages needed for openid server
@@ -165,6 +170,17 @@ class openstackid (
165 170
         ]
166 171
   }
167 172
 
173
+  file { '/etc/openstackid/mail.php':
174
+    ensure  => present,
175
+    content => template('openstackid/mail.php.erb'),
176
+    owner   => 'root',
177
+    group   => 'www-data',
178
+    mode    => '0640',
179
+    require => [
180
+      File['/etc/openstackid'],
181
+    ]
182
+  }
183
+
168 184
   $docroot_dirs = [ '/srv/openstackid' ]
169 185
 
170 186
   file { $docroot_dirs:

+ 124
- 0
templates/mail.php.erb View File

@@ -0,0 +1,124 @@
1
+<?php
2
+
3
+return array(
4
+
5
+	/*
6
+	|--------------------------------------------------------------------------
7
+	| Mail Driver
8
+	|--------------------------------------------------------------------------
9
+	|
10
+	| Laravel supports both SMTP and PHP's "mail" function as drivers for the
11
+	| sending of e-mail. You may specify which one you're using throughout
12
+	| your application here. By default, Laravel is setup for SMTP mail.
13
+	|
14
+	| Supported: "smtp", "mail", "sendmail"
15
+	|
16
+	*/
17
+
18
+	'driver' =>  '<%= @email_driver %>',
19
+
20
+	/*
21
+	|--------------------------------------------------------------------------
22
+	| SMTP Host Address
23
+	|--------------------------------------------------------------------------
24
+	|
25
+	| Here you may provide the host address of the SMTP server used by your
26
+	| applications. A default option is provided that is compatible with
27
+	| the Postmark mail service, which will provide reliable delivery.
28
+	|
29
+	*/
30
+
31
+	'host' => '<%= @email_smtp_server %>',
32
+
33
+	/*
34
+	|--------------------------------------------------------------------------
35
+	| SMTP Host Port
36
+	|--------------------------------------------------------------------------
37
+	|
38
+	| This is the SMTP port used by your application to delivery e-mails to
39
+	| users of your application. Like the host we have set this value to
40
+	| stay compatible with the Postmark e-mail application by default.
41
+	|
42
+	*/
43
+
44
+	'port' => <%= @email_smtp_server_port %>,
45
+
46
+	/*
47
+	|--------------------------------------------------------------------------
48
+	| Global "From" Address
49
+	|--------------------------------------------------------------------------
50
+	|
51
+	| You may wish for all e-mails sent by your application to be sent from
52
+	| the same address. Here, you may specify a name and address that is
53
+	| used globally for all e-mails that are sent by your application.
54
+	|
55
+	*/
56
+
57
+	'from' => array('address' => null, 'name' => null),
58
+
59
+	/*
60
+	|--------------------------------------------------------------------------
61
+	| E-Mail Encryption Protocol
62
+	|--------------------------------------------------------------------------
63
+	|
64
+	| Here you may specify the encryption protocol that should be used when
65
+	| the application send e-mail messages. A sensible default using the
66
+	| transport layer security protocol should provide great security.
67
+	|
68
+	*/
69
+
70
+	'encryption' => 'tls',
71
+
72
+	/*
73
+	|--------------------------------------------------------------------------
74
+	| SMTP Server Username
75
+	|--------------------------------------------------------------------------
76
+	|
77
+	| If your SMTP server requires a username for authentication, you should
78
+	| set it here. This will get used to authenticate with your server on
79
+	| connection. You may also set the "password" value below this one.
80
+	|
81
+	*/
82
+
83
+	'username' => '<%= @email_smtp_server_user %>',
84
+
85
+	/*
86
+	|--------------------------------------------------------------------------
87
+	| SMTP Server Password
88
+	|--------------------------------------------------------------------------
89
+	|
90
+	| Here you may set the password required by your SMTP server to send out
91
+	| messages from your application. This will be given to the server on
92
+	| connection so that the application will be able to send messages.
93
+	|
94
+	*/
95
+
96
+	'password' => '<%= @email_smtp_server_password %>',
97
+
98
+	/*
99
+	|--------------------------------------------------------------------------
100
+	| Sendmail System Path
101
+	|--------------------------------------------------------------------------
102
+	|
103
+	| When using the "sendmail" driver to send e-mails, we will need to know
104
+	| the path to where Sendmail lives on this server. A default path has
105
+	| been provided here, which will work well on most of your systems.
106
+	|
107
+	*/
108
+
109
+	'sendmail' => '/usr/sbin/sendmail -bs',
110
+
111
+	/*
112
+	|--------------------------------------------------------------------------
113
+	| Mail "Pretend"
114
+	|--------------------------------------------------------------------------
115
+	|
116
+	| When this option is enabled, e-mail will not actually be sent over the
117
+	| web and will instead be written to your application's logs files so
118
+	| you may inspect the message. This is great for local development.
119
+	|
120
+	*/
121
+
122
+	'pretend' => false,
123
+
124
+);

Loading…
Cancel
Save