LauncherConstant.java 5.5 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_ARCHIVE_NAME = APPLICATION_NAME_PREFIX + "archive";
  28. String APPLICATION_LAND_NAME = APPLICATION_NAME_PREFIX + "land";
  29. String APPLICATION_VISUAL_NAME = APPLICATION_NAME_PREFIX + "visual";
  30. /**
  31. * xxljob
  32. */
  33. String APPLICATION_XXLJOB_NAME = APPLICATION_NAME_PREFIX + "xxljob";
  34. /**
  35. * xxljob
  36. */
  37. String APPLICATION_XXLJOB_ADMIN_NAME = APPLICATION_NAME_PREFIX + "xxljob-admin";
  38. /**
  39. * nacos dev 地址 172.31.222.127 192.168.0.109 127.0.0.1
  40. */
  41. String NACOS_DEV_ADDR = "127.0.0.1:8848";
  42. /**
  43. * nacos prod 地址
  44. */
  45. String NACOS_PROD_ADDR = "172.30.0.48:8848";
  46. /**
  47. * nacos test 地址
  48. */
  49. String NACOS_TEST_ADDR = "172.30.0.48:8848";
  50. /**
  51. * sentinel dev 地址
  52. */
  53. String SENTINEL_DEV_ADDR = "127.0.0.1:8858";
  54. /**
  55. * sentinel prod 地址
  56. */
  57. String SENTINEL_PROD_ADDR = "172.30.0.58:8858";
  58. /**
  59. * sentinel test 地址
  60. */
  61. String SENTINEL_TEST_ADDR = "172.30.0.58:8858";
  62. /**
  63. * seata dev 地址
  64. */
  65. String SEATA_DEV_ADDR = "127.0.0.1:8091";
  66. /**
  67. * seata prod 地址
  68. */
  69. String SEATA_PROD_ADDR = "172.30.0.68:8091";
  70. /**
  71. * seata test 地址
  72. */
  73. String SEATA_TEST_ADDR = "172.30.0.68:8091";
  74. /**
  75. * zipkin dev 地址
  76. */
  77. String ZIPKIN_DEV_ADDR = "http://127.0.0.1:9411";
  78. /**
  79. * zipkin prod 地址
  80. */
  81. String ZIPKIN_PROD_ADDR = "http://172.30.0.71:9411";
  82. /**
  83. * zipkin test 地址
  84. */
  85. String ZIPKIN_TEST_ADDR = "http://172.30.0.71:9411";
  86. /**
  87. * elk dev 地址
  88. */
  89. String ELK_DEV_ADDR = "127.0.0.1:9000";
  90. /**
  91. * elk prod 地址
  92. */
  93. String ELK_PROD_ADDR = "172.30.0.72:9000";
  94. /**
  95. * elk test 地址
  96. */
  97. String ELK_TEST_ADDR = "172.30.0.72:9000";
  98. /**
  99. * seata file模式
  100. */
  101. String FILE_MODE = "file";
  102. /**
  103. * seata nacos模式
  104. */
  105. String NACOS_MODE = "nacos";
  106. /**
  107. * seata default模式
  108. */
  109. String DEFAULT_MODE = "default";
  110. /**
  111. * seata group后缀
  112. */
  113. String GROUP_NAME = "-group";
  114. /**
  115. * seata 服务组格式
  116. *
  117. * @param appName 服务名
  118. * @return group
  119. */
  120. static String seataServiceGroup(String appName) {
  121. return appName.concat(GROUP_NAME);
  122. }
  123. /**
  124. * 动态获取nacos地址
  125. *
  126. * @param profile 环境变量
  127. * @return addr
  128. */
  129. static String nacosAddr(String profile) {
  130. switch (profile) {
  131. case (AppConstant.PROD_CODE):
  132. return NACOS_PROD_ADDR;
  133. case (AppConstant.TEST_CODE):
  134. return NACOS_TEST_ADDR;
  135. default:
  136. return NACOS_DEV_ADDR;
  137. }
  138. }
  139. /**
  140. * 动态获取sentinel地址
  141. *
  142. * @param profile 环境变量
  143. * @return addr
  144. */
  145. static String sentinelAddr(String profile) {
  146. switch (profile) {
  147. case (AppConstant.PROD_CODE):
  148. return SENTINEL_PROD_ADDR;
  149. case (AppConstant.TEST_CODE):
  150. return SENTINEL_TEST_ADDR;
  151. default:
  152. return SENTINEL_DEV_ADDR;
  153. }
  154. }
  155. /**
  156. * 动态获取seata地址
  157. *
  158. * @param profile 环境变量
  159. * @return addr
  160. */
  161. static String seataAddr(String profile) {
  162. switch (profile) {
  163. case (AppConstant.PROD_CODE):
  164. return SEATA_PROD_ADDR;
  165. case (AppConstant.TEST_CODE):
  166. return SEATA_TEST_ADDR;
  167. default:
  168. return SEATA_DEV_ADDR;
  169. }
  170. }
  171. /**
  172. * 动态获取zipkin地址
  173. *
  174. * @param profile 环境变量
  175. * @return addr
  176. */
  177. static String zipkinAddr(String profile) {
  178. switch (profile) {
  179. case (AppConstant.PROD_CODE):
  180. return ZIPKIN_PROD_ADDR;
  181. case (AppConstant.TEST_CODE):
  182. return ZIPKIN_TEST_ADDR;
  183. default:
  184. return ZIPKIN_DEV_ADDR;
  185. }
  186. }
  187. /**
  188. * 动态获取elk地址
  189. *
  190. * @param profile 环境变量
  191. * @return addr
  192. */
  193. static String elkAddr(String profile) {
  194. switch (profile) {
  195. case (AppConstant.PROD_CODE):
  196. return ELK_PROD_ADDR;
  197. case (AppConstant.TEST_CODE):
  198. return ELK_TEST_ADDR;
  199. default:
  200. return ELK_DEV_ADDR;
  201. }
  202. }
  203. }