123456789101112131415161718192021222324252627282930313233343536373839404142 |
- """
- @author: luojunhui
- """
- import pyapollos
- class Config(object):
- """
- apolloConfig
- """
- def __init__(self, env="pre"):
- """
- :param env:
- """
- if env == "prod":
- self.apollo_connection = pyapollos.ApolloClient(
- app_id="LongArticlesMatchServer",
- config_server_url="https://apolloconfig-internal.piaoquantv.com/",
- timeout=10
- )
- elif env == "dev":
- self.apollo_connection = pyapollos.ApolloClient(
- app_id="LongArticlesMatchServer",
- config_server_url="https://devapolloconfig-internal.piaoquantv.com/",
- timeout=10
- )
- elif env == "pre":
- self.apollo_connection = pyapollos.ApolloClient(
- app_id="LongArticlesMatchServer",
- config_server_url="http://preapolloconfig-internal.piaoquantv.com/",
- timeout=10
- )
- def get_config_value(self, key):
- """
- 通过 key 获取配置的 Config
- :param key:
- :return:
- """
- response = self.apollo_connection.get_value(key)
- return response
|