Help Center > > Developer Guide> Microservice Development Guide> Connecting Microservice Applications to CSE> Connecting Go Chassis Applications to CSE

Connecting Go Chassis Applications to CSE

Updated at: Sep 17, 2021 GMT+08:00

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.

Prerequisites

  • Microservice applications have been developed based on Go chassis.

    For details about microservice application development in the Go chassis microservice framework, see https://go-chassis.readthedocs.io/en/latest/.

  • Version requirements:
    • Golang 1.14 or later
    • Go chassis 2.2.0 or later
    • github.com/go-chassis/go-chassis-cloud v2.1.1 or later

Procedure

  1. 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:

    github.com/go-chassis/go-chassis-cloud v2.1.1

  2. 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

  3. (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
      Add the following configurations:
      cse:
        credentials:
          accessKey: AK
          secretKey: SK
          project: project name
          akskCustomCipher: default
    • 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.

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel