constants.go 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. package config
  2. /**
  3. * structs
  4. **/
  5. const (
  6. LOCAL = "local"
  7. DEV = "dev"
  8. // JSON 설정 파일
  9. ENV_PATH = "./env.json"
  10. CONFIG_PATH_DATABASE = "./config/database.json"
  11. CONFIG_PATH_MOVIE = "./config/movie.json"
  12. CONFIG_PATH_G2A = "./config/g2a.json"
  13. // 로그 파일 경로
  14. ERROR_LOG_PATH_KOBIS = "./log/kobis/error.txt"
  15. ERROR_LOG_PATH_G2A = "./log/g2a/error.txt"
  16. LAST_PAGE_PATH_KOBIS = "./log/kobis/page.txt"
  17. LAST_PAGE_PATH_COMPANY = "./log/kobis/company_page.txt"
  18. // DB 목록
  19. DB_MOVIEW = "movie"
  20. DB_CRAWLER = "crawler"
  21. DB_PLAYR = "playr"
  22. // 데이터 단위
  23. BYTE = 1.0
  24. KILOBYTE = 1024 * BYTE
  25. MEGABYTE = 1024 * KILOBYTE
  26. GIGABYTE = 1024 * MEGABYTE
  27. TERABYTE = 1024 * GIGABYTE
  28. // GeneralLog Action 구분값
  29. GL_ACTION_WRITE = 1
  30. GL_ACTION_MODIFY = 2
  31. GL_ACTION_DELETE = 3
  32. GL_ACTION_SELECT = 4
  33. // 영화진흥윈원회
  34. KOBIS_DOMAIN = "www.kobis.or.kr"
  35. KOBIS_HOST = "https://www.kobis.or.kr"
  36. // 영화 목록 API
  37. MOVIE_LIST = "http://www.kobis.or.kr/kobisopenapi/webservice/rest/movie/searchMovieList.json"
  38. // 영화 상세 정보 API
  39. MOVIE_INFO = "http://www.kobis.or.kr/kobisopenapi/webservice/rest/movie/searchMovieInfo.json"
  40. // 영화 상세 정보 Page
  41. MOVIE_DETAIL = "https://www.kobis.or.kr/kobis/business/mast/mvie/searchMovieDtl.do"
  42. // 영화 일별 박스오피스
  43. MOVIE_DAILY_BOX_OFFICE_LIST = "http://www.kobis.or.kr/kobisopenapi/webservice/rest/boxoffice/searchDailyBoxOfficeList.json"
  44. // 영화 주간/주말 박스오피스
  45. MOVIE_WEEK_BOX_OFFICE_LIST = "http://www.kobis.or.kr/kobisopenapi/webservice/rest/boxoffice/searchWeeklyBoxOfficeList.json"
  46. // 영화 박스오피스 (통계)
  47. MOVIE_BOX_OFFICE_STATS = "http://api.kcisa.kr/openapi/service/rest/meta5/getKFCC0502"
  48. // 영화사 목록 API
  49. COMPANY_LIST = "http://www.kobis.or.kr/kobisopenapi/webservice/rest/company/searchCompanyList.json"
  50. // 영화사 상세 정보 API
  51. COMPANY_INFO = "http://www.kobis.or.kr/kobisopenapi/webservice/rest/company/searchCompanyInfo.json"
  52. // 암호화, 복호화 Key, IV
  53. ENCRYPT_KEY = "8ae4993ba0b0f65ec306a3842b2ab58165006260c5c2a6a3d159e4a18b5679f9"
  54. ENCRYPT_IV = "b3700bce18978aa5152da279619bd6caedcab49c287e50bb0f84cd59696b1759"
  55. )
  56. // 환경설정값
  57. var (
  58. EnvKey = "DEVELOPER_ENV" // 윈도우, 리눅스에 선언된 환경변수 이름
  59. Env *Environment
  60. DB *DBConfig
  61. Movie *MovieConfig
  62. G2A *G2AConfig
  63. )
  64. type Environment struct {
  65. DeveloperEnv string `json:"developerEnv"`
  66. IdentityKey string `json:"identityKey"`
  67. IsDebug bool `json:"isDebug"`
  68. IsLive bool `json:"isLive"`
  69. APP struct {
  70. Port string `json:"port"`
  71. SecretKey string `json:"secretKey"`
  72. ReadTimeout int `json:"readTimeout"`
  73. WriteTimeout int `json:"writeTimeout"`
  74. MaxHeaderBytes int `json:"maxHeaderBytes"`
  75. } `json:"app"`
  76. }
  77. type DBConfig struct {
  78. MaxLifetime int `json:"maxLifetime"`
  79. MaxIdleTime int `json:"maxIdleTime"`
  80. MaxIdleConn int `json:"maxIdleConn"`
  81. MaxOpenConn int `json:"maxOpenConn"`
  82. DBServer
  83. }
  84. type DBServer struct {
  85. Local DBAccount `json:"local"`
  86. Dev DBAccount `json:"dev"`
  87. }
  88. type DBAccount struct {
  89. Driver string `json:"driver"`
  90. User string `json:"user"`
  91. Password string `json:"password"`
  92. Address string `json:"address"`
  93. Name string `json:"name"`
  94. }
  95. // 영화진흥위원회 API
  96. type MovieConfig struct {
  97. Kobis struct {
  98. ApiKey_1 string `json:"apiKey_1"`
  99. ApiKey_2 string `json:"apiKey_2"`
  100. ApiKey_3 string `json:"apiKey_3"`
  101. } `json:"kobis"`
  102. }
  103. // G2A.com API
  104. type G2AConfig struct {
  105. Import G2ACredential `json:"import"`
  106. Export G2ACredential `json:"export"`
  107. Sandbox G2ACredential `json:"sandbox"`
  108. }
  109. type G2ACredential struct {
  110. API string `json:"api"`
  111. Email string `json:"email"`
  112. Client struct {
  113. ID string `json:"id"`
  114. Secret string `json:"secret"`
  115. } `json:"client"`
  116. Hash string `json:"hash"`
  117. IsTest int `json:"isTest"`
  118. }