Skip to content

Commit

Permalink
chore: merge remote
Browse files Browse the repository at this point in the history
  • Loading branch information
whatwewant committed Apr 25, 2024
2 parents ae26890 + 87d564e commit 2c98c0f
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions datasource/env.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package datasource

import "os"

// envDataSource is a data source that loads data from the environment.
type envDataSource struct {
}

// NewEnvSource creates a new envDataSource.
func NewEnvSource() DataSource {
return &envDataSource{}
}

// Get returns the value of the given key.
func (envDataSource) Get(path, key string) any {
if key == "" {
return nil
}

value := os.Getenv(key)
if value == "" {
return nil
}

return value
}

0 comments on commit 2c98c0f

Please sign in to comment.