import os

import cfgtools

hold_times = None


def get_hold_time_config():
    global hold_times

    if hold_times is not None:
        return hold_times

    config = cfgtools.read(os.environ["LOADERCFG"])
    hold_times = []
    hold_config = config.find_group("ProductionConfig")
    if hold_config is not None:
        config_hold_times = config.find_values("ProductionConfig.HoldTimes") or []
        for hold_time in config_hold_times:
            hold_times.append(str(int(int(hold_time) / 60)))

    return hold_times
