constants.go 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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. // 암호화, 복호화 Key, IV
  48. ENCRYPT_KEY = "@@20120726CHrong"
  49. ENCRYPT_IV = "6c2df00f75470f67"
  50. )
  51. // 환경설정값
  52. var (
  53. EnvKey = "DEVELOPER_ENV" // 윈도우, 리눅스에 선언된 환경변수 이름
  54. Env *Environment
  55. DB *DBConfig
  56. Movie *MovieConfig
  57. G2A *G2AConfig
  58. )
  59. type Environment struct {
  60. DeveloperEnv string `json:"developerEnv"`
  61. IdentityKey string `json:"identityKey"`
  62. IsDebug bool `json:"isDebug"`
  63. IsLive bool `json:"isLive"`
  64. APP struct {
  65. Port string `json:"port"`
  66. SecretKey string `json:"secretKey"`
  67. ReadTimeout int `json:"readTimeout"`
  68. WriteTimeout int `json:"writeTimeout"`
  69. MaxHeaderBytes int `json:"maxHeaderBytes"`
  70. } `json:"app"`
  71. }
  72. type DBConfig struct {
  73. MaxLifetime int `json:"maxLifetime"`
  74. MaxIdleTime int `json:"maxIdleTime"`
  75. MaxIdleConn int `json:"maxIdleConn"`
  76. MaxOpenConn int `json:"maxOpenConn"`
  77. DBServer
  78. }
  79. type DBServer struct {
  80. Local DBAccount `json:"local"`
  81. Dev DBAccount `json:"dev"`
  82. }
  83. type DBAccount struct {
  84. Driver string `json:"driver"`
  85. User string `json:"user"`
  86. Password string `json:"password"`
  87. Address string `json:"address"`
  88. Name string `json:"name"`
  89. }
  90. // 영화진흥위원회 API
  91. type MovieConfig struct {
  92. Kobis struct {
  93. ApiKey_1 string `json:"apiKey_1"`
  94. ApiKey_2 string `json:"apiKey_2"`
  95. ApiKey_3 string `json:"apiKey_3"`
  96. } `json:"kobis"`
  97. }
  98. // G2A.com API
  99. type G2AConfig struct {
  100. Import G2ACredential `json:"import"`
  101. Export G2ACredential `json:"export"`
  102. Sandbox G2ACredential `json:"sandbox"`
  103. }
  104. type G2ACredential struct {
  105. API string `json:"api"`
  106. Email string `json:"email"`
  107. Client struct {
  108. ID string `json:"id"`
  109. Secret string `json:"secret"`
  110. } `json:"client"`
  111. Hash string `json:"hash"`
  112. IsTest int `json:"isTest"`
  113. }