""" @author: luojunhui """ import pyapollos class Config(object): """ apolloConfig """ def __init__(self, env="pre"): """ :param env: """ match env: case "prod": self.apollo_connection = pyapollos.ApolloClient( app_id="LongArticlesMatchServer", config_server_url="https://apolloconfig-internal.piaoquantv.com/", timeout=10 ) self.article_match_video_table = "long_articles_match_videos" self.article_text_table = "long_articles_text" self.article_crawler_video_table = "long_articles_crawler_videos" self.root_source_id_table = "long_articles_root_source_id" self.get_off_video_table = "get_off_video" case "dev": self.apollo_connection = pyapollos.ApolloClient( app_id="LongArticlesMatchServer", config_server_url="https://devapolloconfig-internal.piaoquantv.com/", timeout=10 ) self.article_match_video_table = "long_articles_match_videos_copy1" self.article_text_table = "long_articles_text_copy1" self.article_crawler_video_table = "long_articles_crawler_videos_copy1" self.root_source_id_table = "long_articles_root_source_id_copy1" self.get_off_video_table = "get_off_video_copy1" case "pre": self.apollo_connection = pyapollos.ApolloClient( app_id="LongArticlesMatchServer", config_server_url="http://preapolloconfig-internal.piaoquantv.com/", timeout=10 ) self.article_match_video_table = "long_articles_match_videos" self.article_text_table = "long_articles_text" self.article_crawler_video_table = "long_articles_crawler_videos" self.root_source_id_table = "long_articles_root_source_id" self.get_off_video_table = "get_off_video" def get_config_value(self, key): """ 通过 key 获取配置的 Config :param key: :return: """ response = self.apollo_connection.get_value(key) return response