def init_from_config(sha_url=True, integration=None, validate_schemas=False, print_url=True): config = get_config() server_url = urlparse(config['graphql']['server']) server = server_url.geturl() token = config['graphql'].get('token') if sha_url: sha = get_sha(server_url, token) server = server_url._replace(path=f'/graphqlsha/{sha}').geturl() runing_state = RunningState() git_commit_info = get_git_commit_info(sha, server_url, token) runing_state.timestamp = git_commit_info.get('timestamp') runing_state.commit = git_commit_info.get('commit') if print_url: logging.info(f'using gql endpoint {server}') return init(server, token, integration, validate_schemas)
def init_from_config( sha_url=True, integration=None, validate_schemas=False, print_url=True ): config = get_config() server_url = urlparse(config["graphql"]["server"]) server = server_url.geturl() token = config["graphql"].get("token") if sha_url: sha = get_sha(server_url, token) server = server_url._replace(path=f"/graphqlsha/{sha}").geturl() runing_state = RunningState() git_commit_info = get_git_commit_info(sha, server_url, token) runing_state.timestamp = git_commit_info.get("timestamp") runing_state.commit = git_commit_info.get("commit") if print_url: logging.info(f"using gql endpoint {server}") return init(server, token, integration, validate_schemas)