import dotenv from 'dotenv';

dotenv.config({ path: ".env" });

const getBoolean = value => { return value === 'true'? true : false }

const config = {
    dbuser: process.env.DBUSER,
    dbhost: process.env.DBHOST,
    dbname: process.env.DBNAME,
    dbport: Number.parseInt(process.env.DBPORT),
    dbpass: process.env.DBPASS,

    secret: process.env.SECRET,
    app_port: Number.parseInt(process.env.APP_PORT),

    require_token: getBoolean(process.env.REQUIRE_TOKEN),
    delete_token_on_use: getBoolean(process.env.DELETE_TOKEN_ON_USE),

    enable_chat: getBoolean(process.env.ENABLE_CHAT),
    ws_connection_string: process.env.WS_CONNECTION_STRING,

    enable_worldmap: getBoolean(process.env.ENABLE_WORLDMAP),
    worldmap_url: process.env.WORLDMAP_URL,

    skins_target_directory: process.env.SKINS_TARGET_DIRECTORY,
    skins_url: process.env.SKINS_URL,

    capes_target_directory: process.env.CAPES_TARGET_DIRECTORY,
    capes_url: process.env.CAPES_URL
}

export default config;