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