mirror of
https://github.com/teslamate-org/teslamate.git
synced 2026-01-24 21:06:08 +08:00
feat: support accessing PostgreSQL on unix domain sockets (#4456)
* Support configuring teslamate with unix domain sockets for Postgres * docs * reorder * format, cleanup * style: update environment variables documentation for DATABASE_SOCKET_DIR formatting --------- Co-authored-by: Jakob Lichterfeld <jakob-lichterfeld@gmx.de>
This commit is contained in:
co-authored by
Jakob Lichterfeld
parent
61fc3b2627
commit
21d3b520e1
+14
-6
@@ -101,14 +101,22 @@ end
|
||||
config :teslamate,
|
||||
default_geofence: System.get_env("DEFAULT_GEOFENCE")
|
||||
|
||||
case System.get_env("DATABASE_SOCKET_DIR") do
|
||||
nil ->
|
||||
config :teslamate, TeslaMate.Repo,
|
||||
username: Util.fetch_env!("DATABASE_USER", all: "postgres"),
|
||||
password: Util.fetch_env!("DATABASE_PASS", all: "postgres"),
|
||||
hostname: Util.fetch_env!("DATABASE_HOST", all: "localhost"),
|
||||
port: System.get_env("DATABASE_PORT", "5432")
|
||||
|
||||
socket_dir ->
|
||||
config :teslamate, TeslaMate.Repo, socket_dir: socket_dir
|
||||
end
|
||||
|
||||
config :teslamate, TeslaMate.Repo,
|
||||
username: Util.fetch_env!("DATABASE_USER", all: "postgres"),
|
||||
password: Util.fetch_env!("DATABASE_PASS", all: "postgres"),
|
||||
database: Util.fetch_env!("DATABASE_NAME", dev: "teslamate_dev", test: "teslamate_test"),
|
||||
hostname: Util.fetch_env!("DATABASE_HOST", all: "localhost"),
|
||||
port: System.get_env("DATABASE_PORT", "5432"),
|
||||
pool_size: System.get_env("DATABASE_POOL_SIZE", "10") |> String.to_integer(),
|
||||
timeout: System.get_env("DATABASE_TIMEOUT", "60000") |> String.to_integer()
|
||||
timeout: System.get_env("DATABASE_TIMEOUT", "60000") |> String.to_integer(),
|
||||
database: Util.fetch_env!("DATABASE_NAME", dev: "teslamate_dev", test: "teslamate_test")
|
||||
|
||||
case System.get_env("DATABASE_SSL") do
|
||||
"true" ->
|
||||
|
||||
Reference in New Issue
Block a user