import os

import cfgtools

is_change_fund_config_enabled = None


def is_change_fund_enabled():
    # type: (...) -> bool

    global is_change_fund_config_enabled

    if is_change_fund_config_enabled is None:
        config = cfgtools.read(file_or_path=os.environ["LOADERCFG"])
        is_change_fund_config_enabled = config.find_value(
            path="Account.EnableChangeFund",
            default="false",
        )

    return is_change_fund_config_enabled.lower() == "true"
