Fix application for desktop usage

This commit is contained in:
Mikko Ahlroth 2022-09-13 07:53:42 +03:00
parent c240a5cf67
commit 66c80d6b87
2 changed files with 12 additions and 4 deletions

View file

@ -78,13 +78,21 @@ config :geo_therminator,
api_device_reg_set_client_id: get_env("API_DEVICE_REG_SET_CLIENT_ID"),
api_refresh: 10_000,
# Database directory for settings, relative to app HOME path
db_dir: get_env("DB_DIR", "db")
# Database directory for settings
db_dir:
Path.join(
if config_target() in [:ios, :android] do
System.get_env("HOME")
else
Application.app_dir(:geo_therminator, "priv")
end,
get_env("DB_DIR", "db")
)
if config_env() == :dev do
config :geo_therminator, GeoTherminatorWeb.Endpoint,
http: [
0
port: 0
]
end

View file

@ -7,7 +7,7 @@ defmodule GeoTherminator.Application do
@impl true
def start(_type, _args) do
db_dir = System.get_env("HOME") |> Path.join(Application.get_env(:geo_therminator, :db_dir))
db_dir = Application.get_env(:geo_therminator, :db_dir)
children = [
{CubDB, name: GeoTherminator.DB, data_dir: db_dir},