diff --git a/README.md b/README.md index 165589815..918ea994c 100644 --- a/README.md +++ b/README.md @@ -70,11 +70,14 @@ EMAIL_SERVER_URL: '' # DNS name of your smtp server EMAIL_ACCESS_KEY: '' # User for the mail server EMAIL_SECRET_KEY: '' # Password for the user EMAIL_SERVER_PORT: 587 # Mail server port +EMAIL_FROM_ADDRESS: '' # Email address to send from, will default to 'no-reply@orcpub.com' +EMAIL_ERRORS_TO: '' # Email address that errors will be sent to EMAIL_SSL: 'false' # Should SSL be used? Gmail requires this. EMAIL_TLS: 'false' # Should TLS be used? DATOMIC_URL: datomic:free://datomic:4334/orcpub?password=yourpassword # Url for the database ADMIN_PASSWORD: supersecretpassword #The datomic admin password (should be diffrent than the DATOMIC_PASSWORD) DATOMIC_PASSWORD: yourpassword #The datomic application password +SIGNATURE: '' # The Secret used to hash your password in the browser, 20+ characters recommended ``` The `ADMIN_PASSWORD` and `DATOMIC_PASSWORD` @@ -193,10 +196,13 @@ EMAIL_SERVER_URL: '' # Url to a smtp server EMAIL_ACCESS_KEY: '' # User for the mail server EMAIL_SECRET_KEY: '' # Password for the user EMAIL_SERVER_PORT: 587 # Mail server port +EMAIL_FROM_ADDRESS: '' # Email address to send from, will default to 'no-reply@orcpub.com' +EMAIL_ERRORS_TO: '' # Email address that errors will be sent to EMAIL_SSL: 'false' # Should SSL be used? Gmail requires this. DATOMIC_URL: datomic:free://datomic:4334/orcpub?password=yourpassword # Url for the database ADMIN_PASSWORD: supersecretpassword DATOMIC_PASSWORD: yourpassword +SIGNATURE: '' # The Secret used to hash your password in the browser, 20+ characters recommended ``` To change the datomic passwords you can do it through the environment variables `ADMIN_PASSWORD_OLD` and `DATOMIC_PASSWORD_OLD` start the container once, then set the `ADMIN_PASSWORD` and `DATOMIC_PASSWORD` to your new passwords. @@ -462,4 +468,4 @@ The use of this tool is meant for use for your own use and your own content. It Larry Christensen original author of [Orcpub2](https://github.com/larrychristensen/orcpub) ## License -[EPL-2.0](LICENSE) \ No newline at end of file +[EPL-2.0](LICENSE) diff --git a/docker-compose-build.yaml b/docker-compose-build.yaml index b678e1347..296e97768 100644 --- a/docker-compose-build.yaml +++ b/docker-compose-build.yaml @@ -11,12 +11,16 @@ services: EMAIL_ACCESS_KEY: '' EMAIL_SECRET_KEY: '' EMAIL_SERVER_PORT: 587 + # Email address to send from, will default to 'no-reply@orcpub.com' + EMAIL_FROM_ADDRESS: '' # Email address to send errors to EMAIL_ERRORS_TO: '' EMAIL_SSL: 'TRUE' EMAIL_TLS: 'FALSE' # Datomic connection string - Make sure the matches the DATOMIC_PASSWORD below DATOMIC_URL: datomic:free://datomic:4334/orcpub?password= + # The secret used to hash your password in the browser, 20+ characters recommended + SIGNATURE: '' depends_on: - datomic restart: always diff --git a/docker-compose.yaml b/docker-compose.yaml index 24f207616..5ebaa5048 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -9,12 +9,16 @@ services: EMAIL_ACCESS_KEY: '' EMAIL_SECRET_KEY: '' EMAIL_SERVER_PORT: 587 + # Email address to send from, will default to 'no-reply@orcpub.com' + EMAIL_FROM_ADDRESS: '' # Email address to send errors to EMAIL_ERRORS_TO: '' EMAIL_SSL: 'FALSE' EMAIL_TLS: 'FALSE' # Datomic connection string - Make sure the matches the DATOMIC_PASSWORD below DATOMIC_URL: datomic:free://datomic:4334/orcpub?password= + # The secret used to hash your password in the browser, 20+ characters recommended + SIGNATURE: '' depends_on: - datomic restart: always diff --git a/src/clj/orcpub/email.clj b/src/clj/orcpub/email.clj index 258d48c47..8af50a0ea 100644 --- a/src/clj/orcpub/email.clj +++ b/src/clj/orcpub/email.clj @@ -3,6 +3,7 @@ [postal.core :as postal] [environ.core :as environ] [clojure.pprint :as pprint] + [clojure.string :as s] [orcpub.route-map :as routes] [cuerdas.core :as str])) @@ -35,9 +36,12 @@ :tls (or (str/to-bool (environ/env :email-tls)) nil) }) +(defn emailfrom [] + (if (not (s/blank? (environ/env :email-from-address))) (environ/env :email-from-address) (str "no-reply@orcpub.com"))) + (defn send-verification-email [base-url {:keys [email username first-and-last-name]} verification-key] (postal/send-message (email-cfg) - {:from "OrcPub Team " + {:from (str "OrcPub Team <" (emailfrom) ">") :to email :subject "OrcPub Email Verification" :body (verification-email @@ -70,7 +74,7 @@ (defn send-reset-email [base-url {:keys [email username first-and-last-name]} reset-key] (postal/send-message (email-cfg) - {:from "OrcPub Team " + {:from (str "OrcPub Team <" (emailfrom) ">") :to email :subject "OrcPub Password Reset" :body (reset-password-email @@ -80,7 +84,7 @@ (defn send-error-email [context exception] (if (not-empty (environ/env :email-errors-to)) (postal/send-message (email-cfg) - {:from (str "OrcPub Errors <" (environ/env :email-errors-to) ">") + {:from (str "OrcPub Errors <" (emailfrom) ">") :to (str (environ/env :email-errors-to)) :subject "Exception" :body [{:type "text/plain"