123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- """
- @author: luojunhui
- """
- import json
- import pyapollos
- class Config(object):
- """
- apolloConfig
- """
- def __init__(self, env="pre"):
- """
- :param env:
- """
- match env:
- case "prod":
- self.apolloConnection = pyapollos.ApolloClient(
- app_id="LongArticlesMatchServer",
- config_server_url="https://apolloconfig-internal.piaoquantv.com/",
- timeout=10
- )
- self.articleVideos = "long_articles_match_videos"
- self.articleText = "long_articles_text"
- self.articleCrawlerVideos = "long_articles_crawler_videos"
- self.rootSourceIdTable = "long_articles_root_source_id"
- case "dev":
- self.apolloConnection = pyapollos.ApolloClient(
- app_id="LongArticlesMatchServer",
- config_server_url="https://devapolloconfig-internal.piaoquantv.com/",
- timeout=10
- )
- self.articleVideos = "long_articles_match_videos_dev"
- self.articleText = "long_articles_text_dev"
- self.articleCrawlerVideos = "long_articles_crawler_videos_dev"
- self.rootSourceIdTable = "long_articles_root_source_id_dev"
- case "pre":
- self.articleVideos = "long_articles_match_videos"
- self.articleText = "long_articles_text"
- self.articleCrawlerVideos = "long_articles_crawler_videos"
- self.rootSourceIdTable = "long_articles_root_source_id"
- self.apolloConnection = pyapollos.ApolloClient(
- app_id="LongArticlesMatchServer",
- config_server_url="http://preapolloconfig-internal.piaoquantv.com/",
- timeout=10
- )
- def getConfigValue(self, key):
- """
- 通过 key 获取配置的 Config
- :param key:
- :return:
- """
- response = self.apolloConnection.get_value(key)
- return response
|