Connecting Go Chassis Applications to CSE
This section describes how to connect Go chassis applications to CSE and use the most common functions of CSE. For details about the development guide, see Using CSE Functions.
In the Go Chassis Sample Discovery project, you can find the code corresponding to the development methods in this section.
- Microservice applications have been developed based on Go chassis. For details, see Developing Microservice Applications.
- Version requirements:
- Golang 1.14 or later
- Go chassis 2.1.0 or later
- github.com/go-chassis/go-chassis-cloud v2.0.0 or later
- Add dependencies to the go.mod file of the project.
Add the following dependencies to the go.mod file of your project: Skip the operation if your project already contains the following dependency:
- Set the registry center and configuration center.
Add the following configuration items to the chassis.yaml file:
servicecomb: registry: type: servicecenter address: URI of the registry center config: client: type: config_center serverUri: URI of the configuration center
- (Optional) Configure the AK/SK.
Perform this step only when you use the professional microservice engine.
The AK/SK is configured in the chassis.yaml or auth.yaml file. Go chassis provides plaintext configuration by default and allows users to customize the encryption storage scheme.
- Configuration in plaintext
- Custom implementation
After reading secretKey, Go chassis uses the akskCustomCipher plug-in to decrypt secretKey. Therefore, you can use the akskCustomCipher plug-in to encrypt secretKey in plaintext and then configure secretKey.
Add the following configurations:
cse: credentials: accessKey: AK secretKey: SK # SK information in ciphertext project: project name akskCustomCipher: yourCipher
For details about how to develop the akskCustomCipher plug-in, visit https://go-chassis.readthedocs.io/en/latest/dev-guides/how-to-write-cipher.html?highlight=cipher#protect-your-sk.