Skip to content

config does not use ParseEnv option on nested keys. #50

Closed

Description

@beckend

System (please complete the following information):

  • OS: linux
  • GO Version: 1.16.4
  • Pkg Version: 2.0.23

Describe the bug

config does not use ParseEnv option on nested keys.

To Reproduce

import (
    config "github.com/gookit/config/v2"
)

func BugReport() {
	jsonStr := `{
    "envKey": "${SHELL}",
    "map1": {
        "key1": "${SHELL}"
    }
}`

	config.AddDriver(config.JSONDriver)
	config.WithOptions(config.ParseEnv)
	_ = config.LoadStrings(config.JSON, jsonStr)
	// works ok /bin/my-shell
	fmt.Println(config.String("envKey", ""))
	map1 := config.StringMap("map1")
	// "${SHELL}"
	fmt.Println("get map", map1["key1"])
}

Expected behavior
should give me /bin/bash

fmt.Println("get map", map1["key1"])

Activity

  1. added
    enhancement
    on May 18, 2021
  2. beckend commented on May 18, 2021

    @beckend
    ContributorAuthor

    @inhere you have to make a new release.

  3. inhere commented on May 18, 2021

    @inhere
    Member

    has been released, thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions