Skip to content

Commit

Permalink
Enable the use of environment vars (#300)
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniomika authored Mar 8, 2024
1 parent 9f3f566 commit 7ad6956
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/sish.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"io"
"log"
"os"
"strings"
"time"

"github.com/antoniomika/sish/sshmuxer"
Expand Down Expand Up @@ -161,6 +162,8 @@ func initConfig() {
log.Println("Unable to bind pflags:", err)
}

viper.SetEnvPrefix(rootCmd.Use)
viper.SetEnvKeyReplacer(strings.NewReplacer("-", "_"))
viper.AutomaticEnv()

if err := viper.ReadInConfig(); err == nil {
Expand Down

0 comments on commit 7ad6956

Please sign in to comment.