Skip to content
This repository has been archived by the owner on Nov 16, 2020. It is now read-only.

Environment Decoder #31

Open
tanner0101 opened this issue Nov 30, 2018 · 0 comments
Open

Environment Decoder #31

tanner0101 opened this issue Nov 30, 2018 · 0 comments
Labels
enhancement New feature or request

Comments

@tanner0101
Copy link
Member

A decoder for initializing structs from environment variables would be a nice addition to this package.

struct MyConfigVars: Decodable {
    var mysqlURL: String
    var googleToken: String
    var fooID: Int
}

var env = try Environment.detect()
let myConfig = try EnvironmentDecoder().decode(MyConfigVars.self, from: env)

print(myConfig.mysqlURL) // String

This decoder would automatically translate camelCase var names to UPPER_SNAKE_CASE.

@tanner0101 tanner0101 added the enhancement New feature or request label Feb 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant