Skip to content

Commit f7c6413

Browse files
authored
Upgrade viper (#1213)
* Upgrade viper * Backward compatibility for viper configs after version upgrade
1 parent 52401e3 commit f7c6413

File tree

237 files changed

+71076
-15017
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

237 files changed

+71076
-15017
lines changed

go.mod

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ require (
3636
github.com/sirupsen/logrus v1.9.3
3737
github.com/spf13/cobra v1.10.2
3838
github.com/spf13/pflag v1.0.10
39-
github.com/spf13/viper v0.0.0-20160508180713-d8a428b8a306
39+
github.com/spf13/viper v1.21.0
4040
github.com/tdewolff/minify/v2 v2.24.8
4141
github.com/xeipuuv/gojsonschema v1.2.0
4242
golang.org/x/crypto v0.46.0
@@ -46,7 +46,6 @@ require (
4646
)
4747

4848
require (
49-
github.com/BurntSushi/toml v1.5.0 // indirect
5049
github.com/aymerick/raymond v2.0.2+incompatible // indirect
5150
github.com/clipperhouse/displaywidth v0.6.0 // indirect
5251
github.com/clipperhouse/stringish v0.1.1 // indirect
@@ -57,26 +56,28 @@ require (
5756
github.com/gabriel-vasile/mimetype v1.4.11 // indirect
5857
github.com/go-playground/locales v0.14.1 // indirect
5958
github.com/go-playground/universal-translator v0.18.1 // indirect
59+
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
6060
github.com/goccmack/goutil v1.2.3 // indirect
6161
github.com/google/go-cmp v0.7.0 // indirect
6262
github.com/google/go-querystring v1.1.0 // indirect
6363
github.com/google/uuid v1.6.0 // indirect
64-
github.com/hashicorp/hcl v1.0.0 // indirect
6564
github.com/inconshreveable/mousetrap v1.1.0 // indirect
6665
github.com/leodido/go-urn v1.4.0 // indirect
67-
github.com/magiconair/properties v1.8.9 // indirect
6866
github.com/mattn/go-colorable v0.1.13 // indirect
6967
github.com/mattn/go-isatty v0.0.19 // indirect
7068
github.com/mattn/go-runewidth v0.0.19 // indirect
71-
github.com/mitchellh/mapstructure v1.5.0 // indirect
7269
github.com/nxadm/tail v1.4.11 // indirect
7370
github.com/olekukonko/cat v0.0.0-20250911104152-50322a0618f6 // indirect
7471
github.com/olekukonko/errors v1.1.0 // indirect
7572
github.com/olekukonko/ll v0.1.3 // indirect
73+
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
7674
github.com/pkg/errors v0.9.1 // indirect
7775
github.com/robertkrimen/otto v0.5.1 // indirect
78-
github.com/spf13/cast v1.7.1 // indirect
79-
github.com/spf13/jwalterweatherman v1.1.0 // indirect
76+
github.com/sagikazarmark/locafero v0.11.0 // indirect
77+
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect
78+
github.com/spf13/afero v1.15.0 // indirect
79+
github.com/spf13/cast v1.10.0 // indirect
80+
github.com/subosito/gotenv v1.6.0 // indirect
8081
github.com/tdewolff/parse/v2 v2.8.5 // indirect
8182
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
8283
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
@@ -85,7 +86,6 @@ require (
8586
golang.org/x/sys v0.39.0 // indirect
8687
golang.org/x/term v0.38.0 // indirect
8788
golang.org/x/text v0.32.0 // indirect
88-
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
8989
gopkg.in/sourcemap.v1 v1.0.5 // indirect
9090
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
9191
)

go.sum

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg=
2-
github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
31
github.com/ChrisTrenkamp/xsel v0.9.16 h1:/rEkJMh14TEibqfY2fhG2r/UYCMr3aa0bufsG31IBjg=
42
github.com/ChrisTrenkamp/xsel v0.9.16/go.mod h1:fDW9sVs8fwuiDmskzqybrIJ/RsI+vIspxe8G0AVg/+w=
53
github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0=
@@ -70,6 +68,8 @@ github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8Wd
7068
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
7169
github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI=
7270
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
71+
github.com/go-viper/mapstructure/v2 v2.4.0 h1:EBsztssimR/CONLSZZ04E8qAkxNYq4Qp9LvH92wZUgs=
72+
github.com/go-viper/mapstructure/v2 v2.4.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
7373
github.com/go-zoo/bone v1.3.0 h1:PY6sHq37FnQhj+4ZyqFIzJQHvrrGx0GEc3vTZZC/OsI=
7474
github.com/go-zoo/bone v1.3.0/go.mod h1:HI3Lhb7G3UQcAwEhOJ2WyNcsFtQX1WYHa0Hl4OBbhW8=
7575
github.com/goccmack/goutil v1.2.3 h1:acIQAjDl8RLs64e11yFHoPgE3wmvTDbniDZrXq3/GxA=
@@ -104,8 +104,6 @@ github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 h1:JeSE6pjso5T
104104
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674/go.mod h1:r4w70xmWCQKmi1ONH4KIaBptdivuRPyosB9RmPlGEwA=
105105
github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c=
106106
github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
107-
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
108-
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
109107
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
110108
github.com/icrowley/fake v0.0.0-20240710202011-f797eb4a99c0 h1:ufr2e4uIgz/Ft0RPudkFMyVrp77buvTFxqoDvwNGVSk=
111109
github.com/icrowley/fake v0.0.0-20240710202011-f797eb4a99c0/go.mod h1:dQ6TM/OGAe+cMws81eTe4Btv1dKxfPZ2CX+YaAFAPN4=
@@ -124,8 +122,6 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
124122
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
125123
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
126124
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
127-
github.com/magiconair/properties v1.8.9 h1:nWcCbLq1N2v/cpNsy5WvQ37Fb+YElfq20WJ/a8RkpQM=
128-
github.com/magiconair/properties v1.8.9/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
129125
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
130126
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
131127
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
@@ -135,8 +131,6 @@ github.com/mattn/go-runewidth v0.0.19 h1:v++JhqYnZuu5jSKrk9RbgF5v4CGUjqRfBm05byF
135131
github.com/mattn/go-runewidth v0.0.19/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs=
136132
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
137133
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
138-
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
139-
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
140134
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
141135
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
142136
github.com/nxadm/tail v1.4.11 h1:8feyoE3OzPrcshW5/MJ4sGESc5cqmGkGCWlco4l0bqY=
@@ -161,6 +155,8 @@ github.com/onsi/gomega v1.38.3 h1:eTX+W6dobAYfFeGC2PV6RwXRu/MyT+cQguijutvkpSM=
161155
github.com/onsi/gomega v1.38.3/go.mod h1:ZCU1pkQcXDO5Sl9/VVEGlDyp+zm0m1cmeG5TOzLgdh4=
162156
github.com/pborman/uuid v1.2.1 h1:+ZZIw58t/ozdjRaXh/3awHfmWRbzYxJoAdNJxe/3pvw=
163157
github.com/pborman/uuid v1.2.1/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=
158+
github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4=
159+
github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY=
164160
github.com/phayes/freeport v0.0.0-20220201140144-74d24b5ae9f5 h1:Ii+DKncOVM8Cu1Hc+ETb5K+23HdAMvESYE3ZJ5b5cMI=
165161
github.com/phayes/freeport v0.0.0-20220201140144-74d24b5ae9f5/go.mod h1:iIss55rKnNBTvrwdmkUpLnDpZoAHvWaiq5+iMmen4AE=
166162
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
@@ -178,26 +174,31 @@ github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/f
178174
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
179175
github.com/ryanuber/go-glob v1.0.0 h1:iQh3xXAumdQ+4Ufa5b25cRpC5TYKlno6hsv6Cb3pkBk=
180176
github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc=
177+
github.com/sagikazarmark/locafero v0.11.0 h1:1iurJgmM9G3PA/I+wWYIOw/5SyBtxapeHDcg+AAIFXc=
178+
github.com/sagikazarmark/locafero v0.11.0/go.mod h1:nVIGvgyzw595SUSUE6tvCp3YYTeHs15MvlmU87WwIik=
181179
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
182180
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
183-
github.com/spf13/cast v1.7.1 h1:cuNEagBQEHWN1FnbGEjCXL2szYEXqfJPbP2HNUaca9Y=
184-
github.com/spf13/cast v1.7.1/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
181+
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 h1:+jumHNA0Wrelhe64i8F6HNlS8pkoyMv5sreGx2Ry5Rw=
182+
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8/go.mod h1:3n1Cwaq1E1/1lhQhtRK2ts/ZwZEhjcQeJQ1RuC6Q/8U=
183+
github.com/spf13/afero v1.15.0 h1:b/YBCLWAJdFWJTN9cLhiXXcD7mzKn9Dm86dNnfyQw1I=
184+
github.com/spf13/afero v1.15.0/go.mod h1:NC2ByUVxtQs4b3sIUphxK0NioZnmxgyCrfzeuq8lxMg=
185+
github.com/spf13/cast v1.10.0 h1:h2x0u2shc1QuLHfxi+cTJvs30+ZAHOGRic8uyGTDWxY=
186+
github.com/spf13/cast v1.10.0/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qqeHo=
185187
github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU=
186188
github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4=
187-
github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk=
188-
github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo=
189189
github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
190190
github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk=
191191
github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
192-
github.com/spf13/viper v0.0.0-20160508180713-d8a428b8a306 h1:fvXBhJjS/jLG2A5yTggvllwqmgL4P6n6M9BKw1PIFmY=
193-
github.com/spf13/viper v0.0.0-20160508180713-d8a428b8a306/go.mod h1:A8kyI5cUJhb8N+3pkfONlcEcZbueH6nhAm0Fq7SrnBM=
192+
github.com/spf13/viper v1.21.0 h1:x5S+0EU27Lbphp4UKm1C+1oQO+rKx36vfCoaVebLFSU=
193+
github.com/spf13/viper v1.21.0/go.mod h1:P0lhsswPGWD/1lZJ9ny3fYnVqxiegrlNrEmgLjbTCAY=
194194
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
195-
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
196195
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
197196
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
198197
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
199198
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
200199
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
200+
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
201+
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
201202
github.com/tdewolff/minify/v2 v2.24.8 h1:58/VjsbevI4d5FGV0ZSuBrHMSSkH4MCH0sIz/eKIauE=
202203
github.com/tdewolff/minify/v2 v2.24.8/go.mod h1:0Ukj0CRpo/sW/nd8uZ4ccXaV1rEVIWA3dj8U7+Shhfw=
203204
github.com/tdewolff/parse/v2 v2.8.5 h1:ZmBiA/8Do5Rpk7bDye0jbbDUpXXbCdc3iah4VeUvwYU=

hoverctl/configuration/config.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package configuration
33
import (
44
"os"
55
"path/filepath"
6+
"strconv"
67

78
log "github.com/sirupsen/logrus"
89
"github.com/spf13/viper"
@@ -56,6 +57,35 @@ func parseConfig() *Config {
5657
target.Host = defaultTarget.Host
5758
}
5859

60+
// Backward compatibility for admin.port and proxy.port
61+
// Viper unmarshal might fail to map keys with dots into a map of structs
62+
targetMap := viper.GetStringMap("targets." + key)
63+
if target.AdminPort == 0 {
64+
if adminPort, ok := targetMap["admin.port"].(int); ok {
65+
target.AdminPort = adminPort
66+
} else if adminPortStr, ok := targetMap["admin.port"].(string); ok {
67+
target.AdminPort, _ = strconv.Atoi(adminPortStr)
68+
} else if adminPortFloat, ok := targetMap["admin.port"].(float64); ok {
69+
target.AdminPort = int(adminPortFloat)
70+
}
71+
}
72+
73+
if target.ProxyPort == 0 {
74+
if proxyPort, ok := targetMap["proxy.port"].(int); ok {
75+
target.ProxyPort = proxyPort
76+
} else if proxyPortStr, ok := targetMap["proxy.port"].(string); ok {
77+
target.ProxyPort, _ = strconv.Atoi(proxyPortStr)
78+
} else if proxyPortFloat, ok := targetMap["proxy.port"].(float64); ok {
79+
target.ProxyPort = int(proxyPortFloat)
80+
}
81+
}
82+
83+
if target.AuthToken == "" {
84+
if authToken, ok := targetMap["auth.token"].(string); ok {
85+
target.AuthToken = authToken
86+
}
87+
}
88+
5989
if target.AdminPort == 0 {
6090
target.AdminPort = defaultTarget.AdminPort
6191
}

hoverctl/configuration/config_test.go

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,94 @@ targets:
129129
}))
130130
}
131131

132+
func Test_GetConfigWillReadConfigFromAYamlFileWithUnderscore(t *testing.T) {
133+
RegisterTestingT(t)
134+
135+
viper.SetConfigType("yaml")
136+
var configSource = []byte(`
137+
default: local
138+
targets:
139+
local:
140+
name: local
141+
host: localhost
142+
admin_port: 8888
143+
proxy_port: 8500
144+
remote:
145+
name: remote
146+
host: hoverfly.cloud
147+
admin_port: 2345
148+
proxy_port: 9875
149+
`)
150+
151+
_ = viper.ReadConfig(bytes.NewBuffer(configSource))
152+
153+
result := parseConfig()
154+
155+
Expect(*result).To(Equal(Config{
156+
DefaultTarget: "local",
157+
Targets: map[string]Target{
158+
"local": {
159+
Name: "local",
160+
Host: "localhost",
161+
AdminPort: 8888,
162+
ProxyPort: 8500,
163+
},
164+
165+
"remote": {
166+
Name: "remote",
167+
Host: "hoverfly.cloud",
168+
AdminPort: 2345,
169+
ProxyPort: 9875,
170+
},
171+
},
172+
}))
173+
}
174+
175+
func Test_GetConfigWillReadConfigFromAYamlFileWithAuthToken(t *testing.T) {
176+
RegisterTestingT(t)
177+
178+
viper.SetConfigType("yaml")
179+
var configSource = []byte(`
180+
default: local
181+
targets:
182+
local:
183+
name: local
184+
host: localhost
185+
admin.port: 8888
186+
proxy.port: 8500
187+
remote:
188+
name: remote
189+
host: hoverfly.cloud
190+
admin.port: 2345
191+
proxy.port: 9875
192+
auth.token: token456
193+
`)
194+
195+
_ = viper.ReadConfig(bytes.NewBuffer(configSource))
196+
197+
result := parseConfig()
198+
199+
Expect(*result).To(Equal(Config{
200+
DefaultTarget: "local",
201+
Targets: map[string]Target{
202+
"local": {
203+
Name: "local",
204+
Host: "localhost",
205+
AdminPort: 8888,
206+
ProxyPort: 8500,
207+
},
208+
209+
"remote": {
210+
Name: "remote",
211+
Host: "hoverfly.cloud",
212+
AdminPort: 2345,
213+
ProxyPort: 9875,
214+
AuthToken: "token456",
215+
},
216+
},
217+
}))
218+
}
219+
132220
func Test_Config_WriteToFile_WritesTheConfigObjectToAFileInAYamlFormat(t *testing.T) {
133221
RegisterTestingT(t)
134222

hoverctl/configuration/target.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import (
99
type Target struct {
1010
Name string
1111
Host string `yaml:"host,omitempty"`
12-
AdminPort int `mapstructure:"admin.port,omitempty" yaml:"admin.port,omitempty"`
13-
ProxyPort int `mapstructure:"proxy.port,omitempty" yaml:"proxy.port,omitempty"`
14-
AuthToken string `mapstructure:"auth.token,omitempty" yaml:"auth.token,omitempty"`
12+
AdminPort int `mapstructure:"admin_port,omitempty" yaml:"admin.port,omitempty"`
13+
ProxyPort int `mapstructure:"proxy_port,omitempty" yaml:"proxy.port,omitempty"`
14+
AuthToken string `mapstructure:"auth_token,omitempty" yaml:"auth.token,omitempty"`
1515
Pid int `yaml:"pid,omitempty"`
1616

1717
Webserver bool `yaml:",omitempty"`

vendor/github.com/BurntSushi/toml/.gitignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)