markbates / markbates/refresh

set "app_root" from environment variables

Open
#23 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
196
Forks
32
PR merge metrics
No merged PRs in 30d

Description

Hey,

I think it would be nice to be able to set the `app_root` from environment variables like this:
```yaml
app_root: "$GOPATH/src/$APP_PATH"
```

It should be pretty easy to implement this, there just would need to be a call to `os.ExpandEnv(c.AppRoot)` at the end of the [Load function](https://github.com/markbates/refresh/blob/master/refresh/config.go#L47). E.g.:

```go
func (c *Configuration) Load(path string) error {
data, err := ioutil.ReadFile(path)
if err != nil {
return err
}
err = yaml.Unmarshal(data, c)
if err != nil {
return err
}

c.AppRoot = os.ExpandEnv(c.AppRoot)

return err
}
```

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the Load function in refresh/config.go and inspect how YAML populates Configuration.AppRoot. Verify environment expansion for the app_root value, including the documented $GOPATH and $APP_PATH form; done means loading a configuration resolves those variables correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
tooling
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.