opensergo / opensergo-control-plane

Universal cloud-native microservice governance control plane (微服务治理控制面)
Apache License 2.0
35 stars 23 forks source link

support configuration #54

Open jnan806 opened 1 year ago

jnan806 commented 1 year ago

Signed-off-by: Jiangnan Jia jnan0806@gmail.com

Describe what this PR does / why we need it

Add configuration support

Does this pull request fix one issue?

Fixed #18

Describe how you did it

  1. add option style API in NewControlPlane for other control-plane to integrate
  2. Add Priority of loading config: NewControlPlane Options > SystemEnv > YamlFile > Default by this Priority order makes the unique value, when config-items were provided by several way,
  3. If start OpenSergo directly, can also provide config-items by command args, which will adapt to NewControlPlane Options.

Describe how to verify it

  1. exec ./main -h to get command args helps
  2. add different values in command args, SystemEnv, yaml file
    # command args : -p means give a port -c means the path of config
    ./main -p 8080 -c /opensergo.yaml
    # SystemEnv: /etc/profile
    OPENSERGO_ENDPOINT_PORT=8081
    # /opensergo.yaml    filePath which was given by command above
    endpointPort: 8082

Special notes for reviews

sczyh30 commented 1 year ago

cc @123liuziming @panxiaojun233