LauncherConstant.java 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. /*
  2. * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions are met:
  6. *
  7. * Redistributions of source code must retain the above copyright notice,
  8. * this list of conditions and the following disclaimer.
  9. * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * Neither the name of the dreamlu.net developer nor the names of its
  13. * contributors may be used to endorse or promote products derived from
  14. * this software without specific prior written permission.
  15. * Author: Chill 庄骞 (smallchill@163.com)
  16. */
  17. package org.springblade.common.constant;
  18. import org.springblade.core.launch.constant.AppConstant;
  19. import static org.springblade.core.launch.constant.AppConstant.APPLICATION_NAME_PREFIX;
  20. /**
  21. * 启动常量
  22. *
  23. * @author Chill
  24. */
  25. public interface LauncherConstant {
  26. String APPLICATION_MANAGER_NAME = APPLICATION_NAME_PREFIX + "manager"; /*后管*/
  27. String APPLICATION_METER_NAME = APPLICATION_NAME_PREFIX + "meter"; /*计量*/
  28. String APPLICATION_ARCHIVE_NAME = APPLICATION_NAME_PREFIX + "archive"; /*档案*/
  29. String APPLICATION_VISUAL_NAME = APPLICATION_NAME_PREFIX + "visual";
  30. String APPLICATION_LAND_NAME = APPLICATION_NAME_PREFIX + "land";
  31. /**
  32. * xxljob
  33. */
  34. String APPLICATION_XXLJOB_NAME = APPLICATION_NAME_PREFIX + "xxljob";
  35. /**
  36. * xxljob
  37. */
  38. String APPLICATION_XXLJOB_ADMIN_NAME = APPLICATION_NAME_PREFIX + "xxljob-admin";
  39. /**
  40. * nacos dev 地址 172.31.222.127 192.168.0.109 127.0.0.1
  41. */
  42. String NACOS_DEV_ADDR = "127.0.0.1:8848";
  43. /**
  44. * nacos prod 地址
  45. */
  46. String NACOS_PROD_ADDR = "172.30.0.48:8848";
  47. /**
  48. * nacos test 地址
  49. */
  50. String NACOS_TEST_ADDR = "172.30.0.48:8848";
  51. /**
  52. * sentinel dev 地址
  53. */
  54. String SENTINEL_DEV_ADDR = "127.0.0.1:8858";
  55. /**
  56. * sentinel prod 地址
  57. */
  58. String SENTINEL_PROD_ADDR = "172.30.0.58:8858";
  59. /**
  60. * sentinel test 地址
  61. */
  62. String SENTINEL_TEST_ADDR = "172.30.0.58:8858";
  63. /**
  64. * seata dev 地址
  65. */
  66. String SEATA_DEV_ADDR = "127.0.0.1:8091";
  67. /**
  68. * seata prod 地址
  69. */
  70. String SEATA_PROD_ADDR = "172.30.0.68:8091";
  71. /**
  72. * seata test 地址
  73. */
  74. String SEATA_TEST_ADDR = "172.30.0.68:8091";
  75. /**
  76. * zipkin dev 地址
  77. */
  78. String ZIPKIN_DEV_ADDR = "http://127.0.0.1:9411";
  79. /**
  80. * zipkin prod 地址
  81. */
  82. String ZIPKIN_PROD_ADDR = "http://172.30.0.71:9411";
  83. /**
  84. * zipkin test 地址
  85. */
  86. String ZIPKIN_TEST_ADDR = "http://172.30.0.71:9411";
  87. /**
  88. * elk dev 地址
  89. */
  90. String ELK_DEV_ADDR = "192.168.0.119:9000";
  91. /**
  92. * elk prod 地址
  93. */
  94. String ELK_PROD_ADDR = "172.30.0.72:9000";
  95. /**
  96. * elk test 地址
  97. */
  98. String ELK_TEST_ADDR = "172.30.0.72:9000";
  99. /**
  100. * seata file模式
  101. */
  102. String FILE_MODE = "file";
  103. /**
  104. * seata nacos模式
  105. */
  106. String NACOS_MODE = "nacos";
  107. /**
  108. * seata default模式
  109. */
  110. String DEFAULT_MODE = "default";
  111. /**
  112. * seata group后缀
  113. */
  114. String GROUP_NAME = "-group";
  115. /**
  116. * seata 服务组格式
  117. *
  118. * @param appName 服务名
  119. * @return group
  120. */
  121. static String seataServiceGroup(String appName) {
  122. return appName.concat(GROUP_NAME);
  123. }
  124. /**
  125. * 动态获取nacos地址
  126. *
  127. * @param profile 环境变量
  128. * @return addr
  129. */
  130. static String nacosAddr(String profile) {
  131. switch (profile) {
  132. case (AppConstant.PROD_CODE):
  133. return NACOS_PROD_ADDR;
  134. case (AppConstant.TEST_CODE):
  135. return NACOS_TEST_ADDR;
  136. default:
  137. return NACOS_DEV_ADDR;
  138. }
  139. }
  140. /**
  141. * 动态获取sentinel地址
  142. *
  143. * @param profile 环境变量
  144. * @return addr
  145. */
  146. static String sentinelAddr(String profile) {
  147. switch (profile) {
  148. case (AppConstant.PROD_CODE):
  149. return SENTINEL_PROD_ADDR;
  150. case (AppConstant.TEST_CODE):
  151. return SENTINEL_TEST_ADDR;
  152. default:
  153. return SENTINEL_DEV_ADDR;
  154. }
  155. }
  156. /**
  157. * 动态获取seata地址
  158. *
  159. * @param profile 环境变量
  160. * @return addr
  161. */
  162. static String seataAddr(String profile) {
  163. switch (profile) {
  164. case (AppConstant.PROD_CODE):
  165. return SEATA_PROD_ADDR;
  166. case (AppConstant.TEST_CODE):
  167. return SEATA_TEST_ADDR;
  168. default:
  169. return SEATA_DEV_ADDR;
  170. }
  171. }
  172. /**
  173. * 动态获取zipkin地址
  174. *
  175. * @param profile 环境变量
  176. * @return addr
  177. */
  178. static String zipkinAddr(String profile) {
  179. switch (profile) {
  180. case (AppConstant.PROD_CODE):
  181. return ZIPKIN_PROD_ADDR;
  182. case (AppConstant.TEST_CODE):
  183. return ZIPKIN_TEST_ADDR;
  184. default:
  185. return ZIPKIN_DEV_ADDR;
  186. }
  187. }
  188. /**
  189. * 动态获取elk地址
  190. *
  191. * @param profile 环境变量
  192. * @return addr
  193. */
  194. static String elkAddr(String profile) {
  195. switch (profile) {
  196. case (AppConstant.PROD_CODE):
  197. return ELK_PROD_ADDR;
  198. case (AppConstant.TEST_CODE):
  199. return ELK_TEST_ADDR;
  200. default:
  201. return ELK_DEV_ADDR;
  202. }
  203. }
  204. }