Skip to content

Instantly share code, notes, and snippets.

@damonvjanis
Last active May 24, 2021 12:56
Show Gist options
  • Save damonvjanis/a0067e8c88147430aea744bf1b65e26e to your computer and use it in GitHub Desktop.
Save damonvjanis/a0067e8c88147430aea744bf1b65e26e to your computer and use it in GitHub Desktop.
defmodule MyAppWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :my_app
use SiteEncrypt.Phoenix
@impl Phoenix.Endpoint
def init(_key, config) do
{:ok, SiteEncrypt.Phoenix.configure_https(config)}
end
@impl SiteEncrypt
def certification do
SiteEncrypt.configure(
client: :native,
domains: ["<YOUR_DOMAIN.COM>", "<WWW.YOUR_DOMAIN.COM>"],
emails: ["<YOUR_EMAIL>"],
db_folder: Application.get_env(:my_app, :cert_path, "tmp/site_encrypt_db"),
directory_url:
case Application.get_env(:my_app, :cert_mode, "local") do
"local" -> {:internal, port: 4002}
"staging" -> "https://acme-staging-v02.api.letsencrypt.org/directory"
"production" -> "https://acme-v02.api.letsencrypt.org/directory"
end
)
end
# The rest of the file that was already there
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment