__init__.py 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. import logging
  2. import os
  3. env = os.getenv("ANS_ENV")
  4. if not env:
  5. raise Exception("get ANS_ENV failed, set it IN CAUTION!!!")
  6. elif env == "online":
  7. from .online import *
  8. elif env == "test":
  9. from .test import *
  10. elif env == "dev":
  11. from .dev import *
  12. else:
  13. raise Exception("ANS_ENV not in (online, test, dev)")
  14. # REDIS_CONF = {
  15. # "host": REDIS_HOST,
  16. # "port": 6379,
  17. # "password": REDIS_PASSWORD,
  18. # "decode_responses": False,
  19. # "retry_on_timeout": True,
  20. # "max_connections": 50,
  21. # "db": 0
  22. # }
  23. MYSQL_AUTH_CONF = dict(user="admin",
  24. password="NSYbBSPbkGQUbOSNOeyy",
  25. host="retail-data.cnrgrbcygoap.us-east-1.rds.amazonaws.com",
  26. database="ansjer_dvadmin",
  27. port=3306)
  28. MYSQL_DATA_CONF = dict(user=MYSQL_DATA_USER,
  29. password=MASQL_DATA_PASSWORD,
  30. host=MASQL_DATA_HOST,
  31. database="asj_ads",
  32. port=3306)
  33. AWS_LWA_CLIENT = {
  34. 'lwa_client_id': 'amzn1.application-oa2-client.ebd701cd07854fb38c37ee49ec4ba109',
  35. 'lwa_client_secret': 'cbf0514186db4df91e04a8905f0a91b605eae4201254ced879d8bb90df4b474d',
  36. }
  37. LOG_CONF = {
  38. "version": 1,
  39. "disable_existing_loggers": True,
  40. "formatters": {
  41. "normal": {
  42. "class": "logging.Formatter",
  43. "format": "%(asctime)s [%(name)s] %(levelname)s: %(message)s"
  44. }
  45. },
  46. "handlers": {
  47. "console": {
  48. "level": LOG_LEVEL,
  49. "class": "logging.StreamHandler",
  50. "formatter": "normal"
  51. },
  52. "email": {
  53. 'level': 'WARNING',
  54. 'class': 'logging.handlers.SMTPHandler',
  55. 'mailhost': ('email-smtp.us-east-1.amazonaws.com', 587),
  56. 'fromaddr': 'datalab@ansjer.com',
  57. 'toaddrs': [
  58. '1067279008@qq.com',
  59. ],
  60. 'subject': 'sync_amz_data',
  61. 'credentials': ('AKIARBAGHTGOTVILWLB7', 'BEVt2GkzivI0xhnLWgwJCT2k7lDSg8HW+APD3mc4uHVg'),
  62. 'secure': {}
  63. }
  64. },
  65. "loggers": {
  66. "": {
  67. "handlers": LOG_HANDLERS,
  68. "level": "DEBUG",
  69. },
  70. "sync_amz_ad": {
  71. "handlers": LOG_HANDLERS,
  72. "level": LOG_LEVEL,
  73. 'propagate': False,
  74. },
  75. "botocore": {
  76. "level": logging.ERROR,
  77. 'propagate': False,
  78. }
  79. }
  80. }