import sys
import init_easy_env as util

logger = util.logger


def main():
    app2ips = util.get_app_to_ips()

    def _fill_app_node(section_name):
        if section_name not in app2ips:
            return
        ok = util.fill_node(section_name, app2ips[section_name])
        if not ok:
            logger.error("fill %s fail.", section_name)
            sys.exit(255)

    _fill_app_node("easy_core")

    util._fill_redis_sentinel(app2ips.get("redis-sentinel"))


if __name__ == '__main__':
    main()
