LauncherConstant.java 5.0 KB

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