LauncherConstant.java 4.7 KB

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