-module(jchat_config). -export([get/1, get/2, http_port/0, api_domain/0, web_domain/0, static_files_dir/0, cors_origins/0, jwt_secret/0, auth_config/0, database_config/0]). %% Get configuration value with optional default get(Key) -> application:get_env(jchat, Key). get(Key, Default) -> application:get_env(jchat, Key, Default). %% Specific configuration getters http_port() -> get(http_port, 8080). api_domain() -> get(api_domain, "api.jchat.localhost"). web_domain() -> get(web_domain, "web.jchat.localhost"). static_files_dir() -> get(static_files_dir, "../client"). cors_origins() -> get(cors_origins, ["*"]). jwt_secret() -> Secret = get(jwt_secret, "default-secret-change-me"), case Secret of "default-secret-change-me" -> logger:warning("Using default JWT secret - change this in production!"), Secret; _ -> Secret end. auth_config() -> get(auth, []). database_config() -> get(database, []).