Files
Beam/config/runtime.exs
2026-06-10 11:51:56 -05:00

47 lines
1.1 KiB
Elixir

# config/runtime.exs
import Config
import Dotenvy
source!([
"../frm.so/.env",
".env.#{config_env()}",
System.get_env()
])
database_url = env!("DATABASE_URL", :string)
%URI{host: db_host, port: db_port, path: db_path, userinfo: db_userinfo} = URI.parse(database_url)
[db_user, db_password] = String.split(db_userinfo || "", ":", parts: 2)
config :forum, Forum.DB,
hostname: db_host,
port: db_port || 5432,
username: db_user,
password: db_password,
database: String.trim_leading(db_path || "", "/"),
pool_size: env!("POOL_SIZE", :integer, 10)
config :forum, :server,
port: env!("PORT", :integer, 4000),
network_port_base: env!("NETWORK_PORT_BASE", :integer, 4001)
config :forum, :auth,
jwt_secret: env!("JWT_SECRET", :string)
# at the bottom of config/runtime.exs
if config_env() == :prod do
config :logger, :default_handler,
config: [
file: ~c"/root/beam/prod.log",
filesync_repeat_interval: 5_000,
max_no_bytes: 10_000_000,
max_no_files: 5,
compress_on_rotate: true
]
config :logger, :default_formatter,
format: "$time [$level] $message\n",
metadata: [:mfa]
config :logger, level: :info
end