Files
odinsea-elixir/config/runtime.exs

116 lines
5.8 KiB
Elixir

import Config
# Odinsea Server Configuration
# This file maps the Java properties files to Elixir configuration
# ====================================================================================================
# Server Identity
# ====================================================================================================
config :odinsea, :server,
name: System.get_env("ODINSEA_NAME", "Luna"),
host: System.get_env("ODINSEA_HOST", "127.0.0.1"),
revision: String.to_integer(System.get_env("ODINSEA_REV", "1")),
flag: String.to_integer(System.get_env("ODINSEA_FLAG", "0")),
slide_message: System.get_env("ODINSEA_SLIDE_MESSAGE", "Welcome to Luna v99. The Ultimate Private Server"),
data_prefix: System.get_env("ODINSEA_DATA_PREFIX", "Luna")
# ====================================================================================================
# Game Rates
# ====================================================================================================
config :odinsea, :rates,
exp: String.to_integer(System.get_env("ODINSEA_RATE_EXP", "5")),
meso: String.to_integer(System.get_env("ODINSEA_RATE_MESO", "3")),
drop: String.to_integer(System.get_env("ODINSEA_RATE_DROP", "1")),
quest: String.to_integer(System.get_env("ODINSEA_RATE_QUEST", "1"))
# ====================================================================================================
# Login Server
# ====================================================================================================
config :odinsea, :login,
port: String.to_integer(System.get_env("ODINSEA_LOGIN_PORT", "8584")),
user_limit: String.to_integer(System.get_env("ODINSEA_USER_LIMIT", "1500")),
max_characters: String.to_integer(System.get_env("ODINSEA_MAX_CHARACTERS", "3")),
flag: String.to_integer(System.get_env("ODINSEA_LOGIN_FLAG", "3")),
event_message: System.get_env("ODINSEA_EVENT_MESSAGE", "#bLuna v99\\r\\n#rThe Ultimate Private Server")
# ====================================================================================================
# Game Channels
# ====================================================================================================
channel_count = String.to_integer(System.get_env("ODINSEA_CHANNEL_COUNT", "2"))
# Generate channel port configuration
channel_ports =
for i <- 1..channel_count do
port = String.to_integer(System.get_env("ODINSEA_CHANNEL_PORT_#{i}", "#{8584 + i}"))
{i, port}
end
|> Map.new()
config :odinsea, :game,
channels: channel_count,
channel_ports: channel_ports,
events: System.get_env("ODINSEA_EVENTS",
"MiniDungeon,Olivia,PVP,CygnusBattle,ScarTarBattle,VonLeonBattle"
) |> String.split(",")
# ====================================================================================================
# Cash Shop Server
# ====================================================================================================
config :odinsea, :shop,
port: String.to_integer(System.get_env("ODINSEA_SHOP_PORT", "8605"))
# ====================================================================================================
# Database
# ====================================================================================================
config :odinsea, Odinsea.Repo,
database: System.get_env("ODINSEA_DB_NAME", "odin_sea"),
username: System.get_env("ODINSEA_DB_USER", "root"),
password: System.get_env("ODINSEA_DB_PASS", ""),
hostname: System.get_env("ODINSEA_DB_HOST", "localhost"),
port: String.to_integer(System.get_env("ODINSEA_DB_PORT", "3306")),
pool_size: String.to_integer(System.get_env("ODINSEA_DB_POOL_SIZE", "32")),
queue_target: 50,
queue_interval: 1000
# ====================================================================================================
# Redis
# ====================================================================================================
config :odinsea, :redis,
host: System.get_env("ODINSEA_REDIS_HOST", "localhost"),
port: String.to_integer(System.get_env("ODINSEA_REDIS_PORT", "6379")),
timeout: String.to_integer(System.get_env("ODINSEA_REDIS_TIMEOUT", "5000")),
pool_size: String.to_integer(System.get_env("ODINSEA_REDIS_POOL_SIZE", "10"))
# ====================================================================================================
# Feature Flags (from plugin.properties)
# ====================================================================================================
config :odinsea, :features,
admin_mode: System.get_env("ODINSEA_ADMIN_MODE", "false") == "true",
proxy_mode: System.get_env("ODINSEA_PROXY_MODE", "false") == "true",
extra_crypt: System.get_env("ODINSEA_EXTRA_CRYPT", "false") == "true",
log_trace: System.get_env("ODINSEA_LOG_TRACE", "true") == "true",
log_packet: System.get_env("ODINSEA_LOG_PACKET", "true") == "true",
rsa_passwords: System.get_env("ODINSEA_RSA_PASSWORDS", "false") == "true",
script_reload: System.get_env("ODINSEA_SCRIPT_RELOAD", "true") == "true",
family_disable: System.get_env("ODINSEA_FAMILY_DISABLE", "false") == "true",
custom_lang: System.get_env("ODINSEA_CUSTOM_LANG", "false") == "true",
custom_dmgskin: System.get_env("ODINSEA_CUSTOM_DMGSKIN", "true") == "true",
skip_maccheck: System.get_env("ODINSEA_SKIP_MACCHECK", "true") == "true"
# ====================================================================================================
# Logging
# ====================================================================================================
config :logger,
level: String.to_atom(System.get_env("ODINSEA_LOG_LEVEL", "info")),
backends: [:console, {LoggerFileBackend, :file_log}]
config :logger, :console,
format: "$time [$level] $message\n",
metadata: [:module, :function]
config :logger, :file_log,
path: System.get_env("ODINSEA_LOG_PATH", "logs/odinsea.log"),
format: "$date $time [$level] $message\n",
metadata: [:module, :function],
level: :info