constants.go 3.8 KB

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