|
@@ -17,39 +17,47 @@ The simplest way to use this is via docker:
|
17
|
17
|
You should place this service behind an TLS-terminating proxy, and ensure it
|
18
|
18
|
is requested over a secure connection.
|
19
|
19
|
|
20
|
|
-== Command line flags
|
|
20
|
+== Parameters
|
|
21
|
+
|
|
22
|
+The application can be configured either using command line arguments
|
|
23
|
+or environmental variables (shown in square brackets, below).
|
|
24
|
+_from_, _to_, _smtp-host_, _smtp-user_, and _smtp-pass_ are required;
|
|
25
|
+other options have vaguely sensible fallbacks.
|
21
|
26
|
|
22
|
27
|
----
|
23
|
28
|
-crsf-key string
|
24
|
|
- CRSF key to use
|
|
29
|
+ CRSF key to use [CONTACT_CRSF_KEY]
|
25
|
30
|
-from string
|
26
|
|
- address to send e-mail from
|
|
31
|
+ address to send e-mail from [CONTACT_FROM]
|
27
|
32
|
-port int
|
28
|
|
- port to listen on for connections (default 8080)
|
|
33
|
+ port to listen on for connections [CONTACT_PORT] (default 8080)
|
29
|
34
|
-smtp-host string
|
30
|
|
- SMTP server to connect to
|
|
35
|
+ SMTP server to connect to [CONTACT_SMTP_HOST]
|
31
|
36
|
-smtp-pass string
|
32
|
|
- password to supply to the SMTP server
|
|
37
|
+ password to supply to the SMTP server [CONTACT_SMTP_PASS]
|
33
|
38
|
-smtp-port int
|
34
|
|
- port to use when connecting to the SMTP server (default 25)
|
|
39
|
+ port to use when connecting to the SMTP server [CONTACT_SMTP_PORT] (default 25)
|
35
|
40
|
-smtp-user string
|
36
|
|
- username to supply to the SMTP server
|
|
41
|
+ username to supply to the SMTP server [CONTACT_SMTP_USER]
|
37
|
42
|
-subject string
|
38
|
|
- e-mail subject (default "Contact form submission")
|
|
43
|
+ e-mail subject [CONTACT_SUBJECT] (default "Contact form submission")
|
39
|
44
|
-to string
|
40
|
|
- address to send e-mail to
|
|
45
|
+ address to send e-mail to [CONTACT_TO]
|
41
|
46
|
----
|
42
|
47
|
|
43
|
|
-_from_, _to_, _smtp-host_, _smtp-user_, and _smtp-pass_ are required; other options have vaguely sensible fallbacks.
|
|
48
|
+You can use any SMTP server; however I recommend using a dedicated service
|
|
49
|
+such as https://www.mailgun.com/[mailgun] or
|
|
50
|
+https://aws.amazon.com/ses/[AWS SES], both of which you can access over SMTP.
|
44
|
51
|
|
45
|
52
|
== Templates
|
46
|
53
|
|
47
|
54
|
The form itself is loaded from `form.html` in the working directory; success and failure pages from `success.html`
|
48
|
55
|
and `failure.html` respectively. Each is loaded as a https://golang.org/pkg/html/template/[go html.template] and
|
49
|
|
-can use the templating syntax described there.
|
|
56
|
+can use the templating syntax described there. The form must contain the `{{ .csrfField }}` template field, which
|
|
57
|
+will automatically insert the CSRF token for the request.
|
50
|
58
|
|
51
|
|
-The form must contain the `{{ .csrfField }}` template field, which will automatically insert the CSRF token for
|
52
|
|
-the request.
|
|
59
|
+When running from the docker image, templates are stored in `/templates`; you can
|
|
60
|
+replace this with a volume to supply custom templates.
|
53
|
61
|
|
54
|
62
|
== Credits
|
55
|
63
|
|