You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (c.TokenArg!=""||c.TokenFile!="") &&c.needToJoin(nodeConfig) {
185
+
if (c.TokenArg!=""||c.TokenFile!=""||c.TokenEnv!="") &&c.needToJoin(nodeConfig) {
186
+
tokenSources:=0
187
+
ifc.TokenArg!="" {
188
+
tokenSources++
189
+
}
190
+
ifc.TokenFile!="" {
191
+
tokenSources++
192
+
}
193
+
ifc.TokenEnv!="" {
194
+
tokenSources++
195
+
}
196
+
197
+
iftokenSources>1 {
198
+
returnerrors.New("you can only pass one token source: either as a CLI argument 'k0s controller [token]', via '--token-file [path]', or via '--token-env [var]'")
199
+
}
200
+
186
201
vartokenDatastring
187
202
ifc.TokenArg!="" {
188
203
tokenData=c.TokenArg
204
+
} elseifc.TokenEnv!="" {
205
+
tokenValue:=os.Getenv(c.TokenEnv)
206
+
iftokenValue=="" {
207
+
returnfmt.Errorf("environment variable %q is not set or is empty", c.TokenEnv)
returnnil, errors.New("you can only pass one token argument either as a CLI argument 'k0s worker [token]' or as a flag 'k0s worker --token-file [path]'")
157
-
}
156
+
tokenSources++
157
+
}
158
+
iftokenFile!="" {
159
+
tokenSources++
160
+
}
161
+
iftokenEnv!="" {
162
+
tokenSources++
163
+
}
158
164
165
+
iftokenSources>1 {
166
+
returnnil, errors.New("you can only pass one token source: either as a CLI argument 'k0s worker [token]', via '--token-file [path]', or via '--token-env [var]'")
0 commit comments