Alice52 / project

This repository is muti language and tech integration project.
MIT License
0 stars 0 forks source link

[es] nacos multi env #97

Closed Alice52 closed 3 years ago

Alice52 commented 3 years ago

bootstrap.yml

Alice52 commented 3 years ago

temp solution

  1. remove nacos config, and use spring boot built-in feature about multi env.
  2. just use nacos discovery, it can split different env directly.
  3. find solution about nacos config multi env later.
Alice52 commented 3 years ago

solution

  1. we can use start command to fix this issue

    • data id:

      ${prefix}-${spring.profiles.active}.${file-extension}
      java -Dspring.profiles.active=test -jar example-0.0.1-SNAPSHOT.jar
      # bootstramp.yml, and create config file in nacos, such as others-dev.yml
      spring:
        application:
          name: example
        profiles:
            active: dev    
        cloud:
          nacos:
            config:
              server-addr: 192.168.100.10:8848
              file-extension: yaml
    • group:

      java -Dspring.cloud.nacos.config.group=DEV_GROUP -jar example-0.0.1-SNAPSHOT.jar
      # bootstramp.yml, and create config file in nacos, such as others.yml and put in DEV_GROUP
      spring:
        application:
          name: example
        cloud:
          nacos:
            config:
              group: DEV_GROUP
              server-addr: 192.168.100.10:8848
              file-extension: yaml
    • namespace: and please forget switch env by active in this place.

      java -Dspring.cloud.nacos.config.namespace=ns_test -jar example-0.0.1-SNAPSHOT.jar
      # bootstramp.yml, and create config file in nacos, such as others.yml in uuid namsespace
      spring:
        application:
          name: example
        cloud:
          nacos:
            config:
              namespace: uuid
              server-addr: 192.168.100.10:8848
              file-extension: yaml
      java -Dspring.profiles.active=test \
      -Dspring.cloud.nacos.config.namespace=ns_test \
      -Dspring.cloud.nacos.config.group=TEST_GROUP \
      -jar example-0.0.1-SNAPSHOT.jar 
    • link

  2. but I donot think we have to use nacos config.