Skip to content

Commit 7ad6956

Browse files
authored
Enable the use of environment vars (#300)
1 parent 9f3f566 commit 7ad6956

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

cmd/sish.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"io"
77
"log"
88
"os"
9+
"strings"
910
"time"
1011

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

165+
viper.SetEnvPrefix(rootCmd.Use)
166+
viper.SetEnvKeyReplacer(strings.NewReplacer("-", "_"))
164167
viper.AutomaticEnv()
165168

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

0 commit comments

Comments
 (0)