def start_as_score(args): # apply default configure values channel = args.channel or conf.LOOPCHAIN_DEFAULT_CHANNEL score_package = args.score_package or conf.DEFAULT_SCORE_PACKAGE amqp_target = args.amqp_target or conf.AMQP_TARGET amqp_key = args.amqp_key or conf.AMQP_KEY channel_use_icx = conf.CHANNEL_OPTION[channel][ 'send_tx_type'] == conf.SendTxType.icx if channel_use_icx and conf.USE_EXTERNAL_SCORE: if conf.EXTERNAL_SCORE_RUN_IN_LAUNCHER: from iconservice.icon_service import IconService from iconservice.icon_config import default_icon_config from iconcommons.icon_config import IconConfig from iconcommons.logger import Logger additional_conf = { "scoreRootPath": f".storage/.score{amqp_key}", "stateDbRootPath": f".storage/.statedb{amqp_key}", "channel": channel, "amqpKey": amqp_key, } icon_conf = IconConfig("", default_icon_config) icon_conf.load() icon_conf.update(additional_conf) Logger.load_config(icon_conf) icon_service = IconService() icon_service.serve(config=icon_conf) Logger.info(f'==========IconService Done==========', 'IconServiceStandAlone') else: ScoreService(channel, score_package, amqp_target, amqp_key).serve()
def start_as_score(args): # apply default configure values channel = args.channel or conf.LOOPCHAIN_DEFAULT_CHANNEL score_package = args.score_package or conf.DEFAULT_SCORE_PACKAGE amqp_target = args.amqp_target or conf.AMQP_TARGET amqp_key = args.amqp_key or conf.AMQP_KEY conf_path = conf.CONF_PATH_ICONSERVICE_DEV if args.radio_station_target: if args.radio_station_target == conf.URL_CITIZEN_TESTNET: conf_path = conf.CONF_PATH_ICONSERVICE_TESTNET elif args.radio_station_target == conf.URL_CITIZEN_MAINNET: conf_path = conf.CONF_PATH_ICONSERVICE_MAINNET if conf.USE_EXTERNAL_SCORE: if conf.EXTERNAL_SCORE_RUN_IN_LAUNCHER: from iconservice.icon_service import IconService from iconservice.icon_config import default_icon_config from iconcommons.icon_config import IconConfig from iconcommons.logger import Logger with open(conf_path) as file: load_conf = json.load(file) additional_conf = { "log": load_conf.get("log"), "scoreRootPath": load_conf.get("scoreRootPath") + f"{amqp_key}_{channel}", "stateDbRootPath": load_conf.get("stateDbRootPath") + f"{amqp_key}_{channel}", "channel": channel, "amqpKey": amqp_key, "builtinScoreOwner": load_conf.get("builtinScoreOwner"), "service": load_conf.get("service") } icon_conf = IconConfig("", default_icon_config) icon_conf.load() icon_conf.update(additional_conf) Logger.load_config(icon_conf) icon_service = IconService() icon_service.serve(config=icon_conf) Logger.info(f'==========IconService Done==========', 'IconServiceStandAlone') else: ScoreService(channel, score_package, amqp_target, amqp_key).serve()
def start_as_score(args): # apply default configure values channel = args.channel or conf.LOOPCHAIN_DEFAULT_CHANNEL score_package = args.score_package or conf.DEFAULT_SCORE_PACKAGE amqp_target = args.amqp_target or conf.AMQP_TARGET amqp_key = args.amqp_key or conf.AMQP_KEY if util.channel_use_icx(channel) and conf.USE_EXTERNAL_SCORE: if conf.EXTERNAL_SCORE_RUN_IN_LAUNCHER: from iconservice.icon_service import IconService from iconservice.icon_config import default_icon_config from iconcommons.icon_config import IconConfig from iconcommons.logger import Logger additional_conf = { "log": { "logger": "iconservice", "colorLog": True, "level": "info", "filePath": f"./log/icon_service_{channel}.log", "outputType": "console|file" }, "scoreRootPath": f".storage/.score{amqp_key}_{channel}", "stateDbRootPath": f".storage/.statedb{amqp_key}_{channel}", "channel": channel, "amqpKey": amqp_key, "service": { "fee": True, "audit": True, "deployerWhiteList": False, "scorePackageValidator": False } } icon_conf = IconConfig("", default_icon_config) icon_conf.load() icon_conf.update(additional_conf) Logger.load_config(icon_conf) icon_service = IconService() icon_service.serve(config=icon_conf) Logger.info(f'==========IconService Done==========', 'IconServiceStandAlone') else: ScoreService(channel, score_package, amqp_target, amqp_key).serve()
def start_as_score(args): # apply default configure values channel = args.channel or conf.LOOPCHAIN_DEFAULT_CHANNEL score_package = args.score_package or conf.DEFAULT_SCORE_PACKAGE amqp_target = args.amqp_target or conf.AMQP_TARGET amqp_key = args.amqp_key or conf.AMQP_KEY if util.channel_use_icx(channel) and conf.USE_EXTERNAL_SCORE: if conf.EXTERNAL_SCORE_RUN_IN_LAUNCHER: from iconservice.icon_service import IconService from iconservice.icon_config import default_icon_config from iconcommons.icon_config import IconConfig from iconcommons.logger import Logger with open(conf.DEFAULT_SCORE_CONF_PATH) as file: load_conf = json.load(file) additional_conf = { "log": load_conf.get("log"), "scoreRootPath": f".storage/.score{amqp_key}_{channel}", "stateDbRootPath": f".storage/.statedb{amqp_key}_{channel}", "channel": channel, "amqpKey": amqp_key, "builtinScoreOwner": load_conf.get("builtinScoreOwner"), "service": load_conf.get("service") } icon_conf = IconConfig("", default_icon_config) icon_conf.load() icon_conf.update(additional_conf) Logger.load_config(icon_conf) icon_service = IconService() icon_service.serve(config=icon_conf) Logger.info(f'==========IconService Done==========', 'IconServiceStandAlone') else: ScoreService(channel, score_package, amqp_target, amqp_key).serve()