This topic describes how to use GetConfig to get the values of configuration items from Nacos.


You can call the following operation to get the values of configuration items from Nacos:

GetConfig(param vo.ConfigParam) (string, error)

Request parameters

Parameter Type Description

Response parameters

Type Description
String  Indicates the values of configuration items in Nacos.


Go format

package main

import (

func main() {
    //Use the values of End Point and Namespace ID on the Namespace Details page.
    var endpoint = "${endpoint}"
    var namespaceId = "${namespaceId}"

    //Use the AccessKey ID and AccessKey secret of the RAM user.
    var accessKey = "${accessKey}"
    var secretKey = "${secretKey}"

    clientConfig := constant.ClientConfig{
        Endpoint:       endpoint + ":8080",
        NamespaceId:    namespaceId,
        AccessKey:      accessKey,
        SecretKey:      secretKey,
        TimeoutMs:      5 * 1000,
        ListenInterval: 30 * 1000,

    configClient, err := clients.CreateConfigClient(map[string]interface{}{
        "clientConfig": clientConfig,

    if err ! = nil {

    var dataId = ""
    var group = "DEFAULT_GROUP"

    //Get the configuration.
    content, err := configClient.GetConfig(vo.ConfigParam{
        DataId: dataId,
        Group:  group})

    fmt.Println("Get config:" + content)