Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8e86eab

Browse files
committed
fix(clibase): allow empty values to unset defaults
1 parentf88f273 commit8e86eab

File tree

3 files changed

+9
-14
lines changed

3 files changed

+9
-14
lines changed

‎cli/clibase/option.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,7 @@ func (s *OptionSet) ParseEnv(vs []EnvVar) error {
121121
}
122122

123123
envVal,ok:=envs[opt.Env]
124-
// Currently, empty values are treated as if the environment variable is
125-
// unset. This behavior is technically not correct as there is now no
126-
// way for a user to change a Default value to an empty string from
127-
// the environment. Unfortunately, we have old configuration files
128-
// that rely on the faulty behavior.
129-
if!ok||envVal=="" {
124+
if!ok {
130125
continue
131126
}
132127

‎cli/clibase/option_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ func TestOptionSet_ParseEnv(t *testing.T) {
9797
require.EqualValues(t,"foo",workspaceName)
9898
})
9999

100-
t.Run("EmptyValue",func(t*testing.T) {
100+
t.Run("EmptyValueUnsets",func(t*testing.T) {
101101
t.Parallel()
102102

103103
varworkspaceName clibase.String
@@ -116,6 +116,6 @@ func TestOptionSet_ParseEnv(t *testing.T) {
116116

117117
err=os.ParseEnv(clibase.ParseEnviron([]string{"CODER_WORKSPACE_NAME="},"CODER_"))
118118
require.NoError(t,err)
119-
require.EqualValues(t,"defname",workspaceName)
119+
require.EqualValues(t,"",workspaceName)
120120
})
121121
}

‎coder.env

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Coder must be reachable from an external URL for users and workspaces to connect.
22
# e.g. https://coder.example.com
3-
CODER_ACCESS_URL=
3+
#CODER_ACCESS_URL=
44

5-
CODER_ADDRESS=
6-
CODER_PG_CONNECTION_URL=
7-
CODER_TLS_CERT_FILE=
8-
CODER_TLS_ENABLE=
9-
CODER_TLS_KEY_FILE=
5+
#CODER_ADDRESS=
6+
#CODER_PG_CONNECTION_URL=
7+
#CODER_TLS_CERT_FILE=
8+
#CODER_TLS_ENABLE=
9+
#CODER_TLS_KEY_FILE=
1010

1111
# Run "coder server --help" for flag information.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp