Skip to content

Commit

Permalink
Consolidate where my configuration files are for the dev tools
Browse files Browse the repository at this point in the history
  • Loading branch information
benmatselby committed Jul 24, 2019
1 parent f2f215e commit c55f902
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## next

## 2.0.0

- The configuration file has now moved to `~/.benmatselby/walter.yml`.

## 1.0.0

- First initial versioned release of walter.
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Available Commands:
sprint Sprint related commands
Flags:
--config string config file (default is $HOME/.walter/config.yaml)
--config string config file (default is $HOME/.benmatselby/walter.yaml)
-h, --help help for walter
-t, --toggle Help message for toggle
Expand Down Expand Up @@ -49,7 +49,7 @@ Creating a Jira API Token is documented [here](https://confluence.atlassian.com/

### Application configuration file

Long term this may not be required, but right now we need a configuration file (by default, `~/.walter/config.yaml`).
Long term this may not be required, but right now we need a configuration file (by default, `~/.benmatselby/walter.yaml`).

An example:

Expand Down Expand Up @@ -82,13 +82,13 @@ Other than requiring [docker](http://docker.com) to be installed, there are no o

```shell
$ docker run \
--rm \
-t \
-eJIRA_TOKEN \
-eJIRA_URL \
-eJIRA_USERNAME \
-v "${HOME}/.walter":/root/.walter \
benmatselby/walter "$@"
--rm \
-t \
-eJIRA_TOKEN \
-eJIRA_URL \
-eJIRA_USERNAME \
-v "${HOME}/.benmatselby":/root/.benmatselby \
benmatselby/walter "$@"
```

## Installation via Git
Expand Down
8 changes: 3 additions & 5 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func NewRootCommand(client jira.API) *cobra.Command {
Short: "CLI application for retrieving data from Jira",
}

cmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.walter/config.yaml)")
cmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.benmatselby/walter.yaml)")

cmd.AddCommand(
board.NewBoardCommand(client),
Expand All @@ -66,10 +66,8 @@ func initConfig() {
os.Exit(1)
}

// Search config in home directory with name ".walter" (without extension).
path := strings.Join([]string{home, ".walter"}, "/")
viper.AddConfigPath(path)
viper.SetConfigName("config")
viper.AddConfigPath(strings.Join([]string{home, ".benmatselby"}, "/"))
viper.SetConfigName("walter")
}

viper.AutomaticEnv() // read in environment variables that match
Expand Down

0 comments on commit c55f902

Please sign in to comment.