LauncherConstant.java 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. package org.sky.common.constant;
  2. import org.sky.core.launch.constant.AppConstant;
  3. /**
  4. * 启动常量
  5. *
  6. * @author Chill
  7. */
  8. public interface LauncherConstant {
  9. /**
  10. * nacos 用户名
  11. */
  12. String NACOS_USERNAME = "nacos";
  13. /**
  14. * nacos 密码
  15. */
  16. String NACOS_PASSWORD = "nacos";
  17. /**
  18. * nacos dev 地址
  19. */
  20. String NACOS_DEV_ADDR = "47.99.150.200:8848";
  21. String NACOS_DEV_NAMESPACE = "bc98aa53-bc32-4e17-bb82-605c8e95d336";
  22. String NACOS_HOME_ADDR = "47.99.150.200:8848";
  23. String NACOS_HOME_NAMESPACE = "9f24a600-102c-48f2-9e42-ac850986db45";
  24. /**
  25. * nacos prod 地址
  26. */
  27. String NACOS_PROD_ADDR = "172.30.0.48:8848";
  28. String NACOS_PROD_NAMESPACE = "6a3a2b86-c938-4188-b1ff-cd5f909c6b6c";
  29. /**
  30. * nacos test 地址
  31. */
  32. String NACOS_TEST_ADDR = "172.18.238.53:8848";
  33. String NACOS_TEST_NAMESPACE = "6a3a2b86-c938-4188-b1ff-cd5f909c6b6c";
  34. /**
  35. * sentinel dev 地址
  36. */
  37. String SENTINEL_DEV_ADDR = "127.0.0.1:8858";
  38. /**
  39. * sentinel prod 地址
  40. */
  41. String SENTINEL_PROD_ADDR = "172.30.0.58:8858";
  42. /**
  43. * sentinel test 地址
  44. */
  45. String SENTINEL_TEST_ADDR = "172.30.0.58:8858";
  46. /**
  47. * seata dev 地址
  48. */
  49. String SEATA_DEV_ADDR = "127.0.0.1:8091";
  50. /**
  51. * seata prod 地址
  52. */
  53. String SEATA_PROD_ADDR = "172.30.0.68:8091";
  54. /**
  55. * seata test 地址
  56. */
  57. String SEATA_TEST_ADDR = "172.30.0.68:8091";
  58. /**
  59. * zipkin dev 地址
  60. */
  61. String ZIPKIN_DEV_ADDR = "http://127.0.0.1:9411";
  62. /**
  63. * zipkin prod 地址
  64. */
  65. String ZIPKIN_PROD_ADDR = "http://172.30.0.71:9411";
  66. /**
  67. * zipkin test 地址
  68. */
  69. String ZIPKIN_TEST_ADDR = "http://172.30.0.71:9411";
  70. /**
  71. * elk dev 地址
  72. */
  73. String ELK_DEV_ADDR = "127.0.0.1:9000";
  74. /**
  75. * elk prod 地址
  76. */
  77. String ELK_PROD_ADDR = "172.30.0.72:9000";
  78. /**
  79. * elk test 地址
  80. */
  81. String ELK_TEST_ADDR = "172.30.0.72:9000";
  82. /**
  83. * seata file模式
  84. */
  85. String FILE_MODE = "file";
  86. /**
  87. * seata nacos模式
  88. */
  89. String NACOS_MODE = "nacos";
  90. /**
  91. * seata default模式
  92. */
  93. String DEFAULT_MODE = "default";
  94. /**
  95. * seata group后缀
  96. */
  97. String GROUP_NAME = "-group";
  98. /**
  99. * seata 服务组格式
  100. *
  101. * @param appName 服务名
  102. * @return group
  103. */
  104. static String seataServiceGroup(String appName) {
  105. return appName.concat(GROUP_NAME);
  106. }
  107. /**
  108. * 动态获取nacos地址
  109. *
  110. * @param profile 环境变量
  111. * @return addr
  112. */
  113. static String nacosAddr(String profile) {
  114. return switch (profile) {
  115. case (AppConstant.PROD_CODE) -> NACOS_PROD_ADDR;
  116. case (AppConstant.TEST_CODE) -> NACOS_TEST_ADDR;
  117. case (AppConstant.HOME_CODE) -> NACOS_HOME_ADDR;
  118. default -> NACOS_DEV_ADDR;
  119. };
  120. }
  121. static String nacosNamespace(String profile) {
  122. return switch (profile) {
  123. case (AppConstant.PROD_CODE) -> NACOS_PROD_NAMESPACE;
  124. case (AppConstant.TEST_CODE) -> NACOS_TEST_NAMESPACE;
  125. case (AppConstant.HOME_CODE) -> NACOS_HOME_NAMESPACE;
  126. default -> NACOS_DEV_NAMESPACE;
  127. };
  128. }
  129. /**
  130. * 动态获取sentinel地址
  131. *
  132. * @param profile 环境变量
  133. * @return addr
  134. */
  135. static String sentinelAddr(String profile) {
  136. return switch (profile) {
  137. case (AppConstant.PROD_CODE) -> SENTINEL_PROD_ADDR;
  138. case (AppConstant.TEST_CODE) -> SENTINEL_TEST_ADDR;
  139. default -> SENTINEL_DEV_ADDR;
  140. };
  141. }
  142. /**
  143. * 动态获取seata地址
  144. *
  145. * @param profile 环境变量
  146. * @return addr
  147. */
  148. static String seataAddr(String profile) {
  149. return switch (profile) {
  150. case (AppConstant.PROD_CODE) -> SEATA_PROD_ADDR;
  151. case (AppConstant.TEST_CODE) -> SEATA_TEST_ADDR;
  152. default -> SEATA_DEV_ADDR;
  153. };
  154. }
  155. /**
  156. * 动态获取zipkin地址
  157. *
  158. * @param profile 环境变量
  159. * @return addr
  160. */
  161. static String zipkinAddr(String profile) {
  162. return switch (profile) {
  163. case (AppConstant.PROD_CODE) -> ZIPKIN_PROD_ADDR;
  164. case (AppConstant.TEST_CODE) -> ZIPKIN_TEST_ADDR;
  165. default -> ZIPKIN_DEV_ADDR;
  166. };
  167. }
  168. /**
  169. * 动态获取elk地址
  170. *
  171. * @param profile 环境变量
  172. * @return addr
  173. */
  174. static String elkAddr(String profile) {
  175. return switch (profile) {
  176. case (AppConstant.PROD_CODE) -> ELK_PROD_ADDR;
  177. case (AppConstant.TEST_CODE) -> ELK_TEST_ADDR;
  178. default -> ELK_DEV_ADDR;
  179. };
  180. }
  181. }