MF-942 - Fix email template logic (#944)
* fix email template Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * rename resetPasswEmail.tmpl Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * add env var Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * rename resetPasswEmail.tmpl Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * rename resetPasswEmail.tmpl Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * upd docs Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * upd docs Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * upd docs Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * remove not needed file Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * move email tmpl Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * move email tmpl Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * move email tmpl Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * variable for tmpl Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * fix ident and caps Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
This commit is contained in:
parent
e735e5c01b
commit
9e8dd4b149
2
.env
2
.env
|
@ -44,7 +44,7 @@ MF_EMAIL_USERNAME=18bf7f70705139
|
|||
MF_EMAIL_PASSWORD=2b0d302e775b1e
|
||||
MF_EMAIL_FROM_ADDRESS=from@example.com
|
||||
MF_EMAIL_FROM_NAME=Example
|
||||
MF_EMAIL_TEMPLATE=/resetPasswEmail.tmpl
|
||||
MF_EMAIL_TEMPLATE=email.tmpl
|
||||
|
||||
### Token utility
|
||||
MF_TOKEN_SECRET=some_random_bytes
|
||||
|
|
|
@ -65,7 +65,7 @@ const (
|
|||
defEmailPassword = ""
|
||||
defEmailFromAddress = ""
|
||||
defEmailFromName = ""
|
||||
defEmailTemplate = "../configs/resetPasswEmail.tmpl"
|
||||
defEmailTemplate = "email.tmpl"
|
||||
|
||||
defTokenSecret = "mainflux-secret"
|
||||
defTokenDuration = "5"
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
To: {{.To}}
|
||||
From: {{.From}}
|
||||
Subject: {{.Subject}}
|
||||
{{.Header}}
|
||||
{{.Content}}
|
||||
{{.Footer}}
|
||||
|
|
@ -67,7 +67,7 @@ services:
|
|||
image: mainflux/users:latest
|
||||
container_name: mainflux-users
|
||||
volumes:
|
||||
- ../users/emailer/templates/${MF_EMAIL_TEMPLATE}:${MF_EMAIL_TEMPLATE}
|
||||
- ./users/emailer/templates/${MF_EMAIL_TEMPLATE}:/${MF_EMAIL_TEMPLATE}
|
||||
depends_on:
|
||||
- users-db
|
||||
expose:
|
||||
|
@ -91,10 +91,10 @@ services:
|
|||
MF_EMAIL_PASSWORD: ${MF_EMAIL_PASSWORD}
|
||||
MF_EMAIL_FROM_ADDRESS: ${MF_EMAIL_FROM_ADDRESS}
|
||||
MF_EMAIL_FROM_NAME: ${MF_EMAIL_FROM_NAME}
|
||||
MF_EMAIL_TEMPLATE: ${MF_EMAIL_TEMPLATE}
|
||||
MF_TOKEN_SECRET: ${MF_TOKEN_SECRET}
|
||||
MF_TOKEN_DURATION: ${MF_TOKEN_DURATION}
|
||||
MF_TOKEN_RESET_ENDPOINT: ${MF_TOKEN_RESET_ENDPOINT}
|
||||
MF_EMAIL_TEMPLATE: ${MF_EMAIL_TEMPLATE}
|
||||
ports:
|
||||
- ${MF_USERS_HTTP_PORT}:${MF_USERS_HTTP_PORT}
|
||||
networks:
|
||||
|
|
|
@ -38,7 +38,7 @@ done
|
|||
###
|
||||
# Users
|
||||
###
|
||||
MF_USERS_LOG_LEVEL=info $BUILD_DIR/mainflux-users &
|
||||
MF_USERS_LOG_LEVEL=info MF_EMAIL_TEMPLATE=../docker/users/emailer/templates/email.tmpl $BUILD_DIR/mainflux-users &
|
||||
|
||||
###
|
||||
# Things
|
||||
|
|
|
@ -41,9 +41,9 @@ default values.
|
|||
| MF_EMAIL_PASSWORD | Mail server password | |
|
||||
| MF_EMAIL_FROM_ADDRESS | Email "from" address | |
|
||||
| MF_EMAIL_FROM_NAME | Email "from" name | |
|
||||
| MF_TOKEN_SECRET | Token secret for signing token used for password reset | |
|
||||
| MF_EMAIL_TEMPLATE | Email template for sending emails with password reset link | email.tmpl |
|
||||
| MF_TOKEN_SECRET | Password reset token signing secret | |
|
||||
| MF_TOKEN_DURATION | Token duration in minutes | 5 |
|
||||
| MF_TOKEN_DEBUG_LEVEL | Token util debug level | info |
|
||||
| MF_TOKEN_RESET_ENDPOINT | Password request reset endpoint, for constructing link | /reset-request |
|
||||
|
||||
## Deployment
|
||||
|
@ -84,9 +84,9 @@ services:
|
|||
MF_EMAIL_PASSWORD: [MF_EMAIL_PASSWORD]
|
||||
MF_EMAIL_FROM_ADDRESS: [MF_EMAIL_FROM_ADDRESS]
|
||||
MF_EMAIL_FROM_NAME: [MF_EMAIL_FROM_NAME]
|
||||
MF_EMAIL_TEMPLATE: [MF_EMAIL_TEMPLATE]
|
||||
MF_TOKEN_SECRET: [MF_TOKEN_SECRET]
|
||||
MF_TOKEN_DURATION: [MF_TOKEN_DURATION]
|
||||
MF_TOKEN_DEBUG_LEVEL: [MF_TOKEN_DEBUG_LEVEL]
|
||||
MF_TOKEN_RESET_ENDPOINT: [MF_TOKEN_RESET_ENDPOINT]
|
||||
```
|
||||
|
||||
|
@ -105,9 +105,11 @@ make users
|
|||
make install
|
||||
|
||||
# set the environment variables and run the service
|
||||
MF_USERS_LOG_LEVEL=[Users log level] MF_USERS_DB_HOST=[Database host address] MF_USERS_DB_PORT=[Database host port] MF_USERS_DB_USER=[Database user] MF_USERS_DB_PASS=[Database password] MF_USERS_DB=[Name of the database used by the service] MF_USERS_DB_SSL_MODE=[SSL mode to connect to the database with] MF_USERS_DB_SSL_CERT=[Path to the PEM encoded certificate file] MF_USERS_DB_SSL_KEY=[Path to the PEM encoded key file] MF_USERS_DB_SSL_ROOT_CERT=[Path to the PEM encoded root certificate file] MF_USERS_HTTP_PORT=[Service HTTP port] MF_USERS_GRPC_PORT=[Service gRPC port] MF_USERS_SECRET=[String used for signing tokens] MF_USERS_SERVER_CERT=[Path to server certificate] MF_USERS_SERVER_KEY=[Path to server key] MF_JAEGER_URL=[Jaeger server URL] $GOBIN/mainflux-users
|
||||
MF_USERS_LOG_LEVEL=[Users log level] MF_USERS_DB_HOST=[Database host address] MF_USERS_DB_PORT=[Database host port] MF_USERS_DB_USER=[Database user] MF_USERS_DB_PASS=[Database password] MF_USERS_DB=[Name of the database used by the service] MF_USERS_DB_SSL_MODE=[SSL mode to connect to the database with] MF_USERS_DB_SSL_CERT=[Path to the PEM encoded certificate file] MF_USERS_DB_SSL_KEY=[Path to the PEM encoded key file] MF_USERS_DB_SSL_ROOT_CERT=[Path to the PEM encoded root certificate file] MF_USERS_HTTP_PORT=[Service HTTP port] MF_USERS_GRPC_PORT=[Service gRPC port] MF_USERS_SECRET=[String used for signing tokens] MF_USERS_SERVER_CERT=[Path to server certificate] MF_USERS_SERVER_KEY=[Path to server key] MF_JAEGER_URL=[Jaeger server URL] MF_EMAIL_DRIVER=[Mail server driver smtp] MF_EMAIL_HOST=[Mail server host] MF_EMAIL_PORT=[Mail server port] MF_EMAIL_USERNAME=[Mail server username] MF_EMAIL_PASSWORD=[Mail server password] MF_EMAIL_FROM_ADDRESS=[Email from address] MF_EMAIL_FROM_NAME=[Email from name] MF_EMAIL_TEMPLATE=[Email template file] MF_TOKEN_SECRET=[Password reset token signing secret] MF_TOKEN_DURATION=[Password reset token duration] MF_TOKEN_RESET_ENDPOINT=[Password reset token endpoint] $GOBIN/mainflux-users
|
||||
```
|
||||
|
||||
If `MF_EMAIL_TEMPLATE` doesn't point to any file service will function but password reset functionality will not work.
|
||||
|
||||
## Usage
|
||||
|
||||
For more information about service capabilities and its usage, please check out
|
||||
|
|
Loading…
Reference in New Issue