Skip to content

Commit

Permalink
Support server_name_indication for ssl (#3497)
Browse files Browse the repository at this point in the history
* Support server_name_indication for ssl

* update format
  • Loading branch information
simonsmh authored Nov 26, 2023
1 parent e7e410a commit 7329b2b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,14 @@ case System.get_env("DATABASE_SSL") do
"noverify" ->
config :teslamate, TeslaMate.Repo,
ssl: true,
ssl_opts: [verify: :verify_none]
ssl_opts: [
server_name_indication:
to_charlist(
System.get_env("DATABASE_SSL_SNI") ||
Util.fetch_env!("DATABASE_HOST", all: "localhost")
),
verify: :verify_none
]

_false ->
config :teslamate, TeslaMate.Repo, ssl: false
Expand Down
1 change: 1 addition & 0 deletions website/docs/configuration/environment_variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ TeslaMate accepts the following environment variables for runtime configuration:
| **DATABASE_TIMEOUT** | The time in milliseconds to wait for database query calls to finish | 60000 |
| **DATABASE_SSL** | Set to `true` if SSL should be enabled or `noverify` if certificate verification should not be performed. | false |
| **DATABASE_SSL_CA_CERT_FILE** | Path to a file containing PEM-encoded CA certificates (required if `DATABASE_SSL` is set to `true`) | |
| **DATABASE_SSL_SNI** | set SNI for host undel ssl mode | |
| **DATABASE_IPV6** | Set to `true` if IPv6 should be used | false |
| **VIRTUAL_HOST** | Host part used for generating URLs throughout the app | localhost |
| **CHECK_ORIGIN** | Configures whether to check the origin header or not. May be `true` (**recommended**), `false` (_default_) or a comma-separated list of hosts that are allowed (e.g. `https://example.com,//another.com:8080`). Hosts also support wildcards. If `true`, it will check against the host value in `VIRTUAL_HOST`. | false |
Expand Down

0 comments on commit 7329b2b

Please sign in to comment.