def start_as_rest_server(args): peer_port = args.port channel = conf.LOOPCHAIN_DEFAULT_CHANNEL amqp_key = args.amqp_key or conf.AMQP_KEY api_port = int(peer_port) + conf.PORT_DIFF_REST_SERVICE_CONTAINER from iconrpcserver.default_conf.icon_rpcserver_config import default_rpcserver_config from iconrpcserver.icon_rpcserver_cli import start_process, find_procs_by_params from iconcommons.icon_config import IconConfig from iconcommons.logger import Logger additional_conf = { "log": { "logger": "iconrpcserver", "colorLog": True, "level": "info", "filePath": "./log/iconrpcserver.log", "outputType": "console|file" }, "channel": channel, "port": api_port, "amqpKey": amqp_key, "gunicornWorkerCount": 1, "tbearsMode": False } rpcserver_conf = IconConfig("", default_rpcserver_config) rpcserver_conf.load() rpcserver_conf.update_conf(additional_conf) Logger.load_config(rpcserver_conf) if not find_procs_by_params(api_port): start_process(conf=rpcserver_conf) Logger.info("start_command done!, IconRpcServerCli")
def start_as_rest_server(args): from iconcommons.icon_config import IconConfig from iconrpcserver.default_conf.icon_rpcserver_config import default_rpcserver_config from iconrpcserver.icon_rpcserver_cli import start_process, find_procs_by_params amqp_key = args.amqp_key or conf.AMQP_KEY api_port = int(args.port) + conf.PORT_DIFF_REST_SERVICE_CONTAINER conf_path = conf.CONF_PATH_ICONRPCSERVER_DEV if args.radio_station_target == conf.URL_CITIZEN_TESTNET: conf_path = conf.CONF_PATH_ICONRPCSERVER_TESTNET elif args.radio_station_target == conf.URL_CITIZEN_MAINNET: conf_path = conf.CONF_PATH_ICONRPCSERVER_MAINNET additional_conf = { "port": api_port, "config": conf_path, "amqpTarget": conf.AMQP_TARGET, "amqpKey": amqp_key, "channel": conf.LOOPCHAIN_DEFAULT_CHANNEL, "tbearsMode": False } rpcserver_conf: IconConfig = IconConfig("", default_rpcserver_config) rpcserver_conf.load() rpcserver_conf.update_conf(additional_conf) if not find_procs_by_params(api_port): start_process(conf=rpcserver_conf) logging.info("start_command done!, IconRpcServerCli")
def start_as_rest_server(args): peer_port = args.port channel = conf.LOOPCHAIN_DEFAULT_CHANNEL amqp_key = args.amqp_key or conf.AMQP_KEY api_port = int(peer_port) + conf.PORT_DIFF_REST_SERVICE_CONTAINER conf_path = conf.CONF_PATH_ICONRPCSERVER_DEV if args.radio_station_target: if args.radio_station_target == conf.URL_CITIZEN_TESTNET: conf_path = conf.CONF_PATH_ICONRPCSERVER_TESTNET elif args.radio_station_target == conf.URL_CITIZEN_MAINNET: conf_path = conf.CONF_PATH_ICONRPCSERVER_MAINNET from iconrpcserver.default_conf.icon_rpcserver_config import default_rpcserver_config from iconrpcserver.icon_rpcserver_cli import start_process, find_procs_by_params 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"), "channel": channel, "port": api_port, "amqpKey": amqp_key, "gunicornWorkerCount": 1, "tbearsMode": False } rpcserver_conf = IconConfig("", default_rpcserver_config) rpcserver_conf.load() rpcserver_conf.update_conf(additional_conf) Logger.load_config(rpcserver_conf) if not find_procs_by_params(api_port): start_process(conf=rpcserver_conf) Logger.info("start_command done!, IconRpcServerCli")