Skip to content

Commit 0f3221f

Browse files
authored
fix: use more descriptive login flags (#4493)
1 parent c13e682 commit 0f3221f

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

cli/login.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,9 @@ func login() *cobra.Command {
248248
return nil
249249
},
250250
}
251-
cliflag.StringVarP(cmd.Flags(), &email, "email", "e", "CODER_EMAIL", "", "Specifies an email address to authenticate with.")
252-
cliflag.StringVarP(cmd.Flags(), &username, "username", "u", "CODER_USERNAME", "", "Specifies a username to authenticate with.")
253-
cliflag.StringVarP(cmd.Flags(), &password, "password", "p", "CODER_PASSWORD", "", "Specifies a password to authenticate with.")
251+
cliflag.StringVarP(cmd.Flags(), &email, "first-user-email", "", "CODER_FIRST_USER_EMAIL", "", "Specifies an email address to use if creating the first user for the deployment.")
252+
cliflag.StringVarP(cmd.Flags(), &username, "first-user-username", "", "CODER_FIRST_USER_USERNAME", "", "Specifies a username to use if creating the first user for the deployment.")
253+
cliflag.StringVarP(cmd.Flags(), &password, "first-user-password", "", "CODER_FIRST_USER_PASSWORD", "", "Specifies a password to use if creating the first user for the deployment.")
254254
return cmd
255255
}
256256

cli/login_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func TestLogin(t *testing.T) {
7474
// accurately detect Windows ptys when they are not attached to a process:
7575
// https://github.com/mattn/go-isatty/issues/59
7676
doneChan := make(chan struct{})
77-
root, _ := clitest.New(t, "login", client.URL.String(), "--username", "testuser", "--email", "user@coder.com", "--password", "password")
77+
root, _ := clitest.New(t, "login", client.URL.String(), "--first-user-username", "testuser", "--first-user-email", "user@coder.com", "--first-user-password", "password")
7878
pty := ptytest.New(t)
7979
root.SetIn(pty.Input())
8080
root.SetOut(pty.Output())

examples/lima/coder.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ provision:
9595
# If we are already logged in, nothing to do
9696
coder templates list >/dev/null 2>&1 && exit 0
9797
# Set up initial user
98-
[ ! -e ~/.config/coderv2/session ] && coder login http://localhost:3000 --username admin --email admin@coder.com --password $(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c8 | tee ${HOME}/.config/coderv2/password)
98+
[ ! -e ~/.config/coderv2/session ] && coder login http://localhost:3000 --first-user-username admin --first-user-email admin@coder.com --first-user-password $(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c8 | tee ${HOME}/.config/coderv2/password)
9999
# Create an initial template
100100
temp_template_dir=$(mktemp -d)
101101
echo code-server | coder templates init "${temp_template_dir}"

scripts/develop.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ CODER_DEV_SHIM="${PROJECT_ROOT}/scripts/coder-dev.sh"
6666

6767
if [ ! -f "${PROJECT_ROOT}/.coderv2/developsh-did-first-setup" ]; then
6868
# Try to create the initial admin user.
69-
"${CODER_DEV_SHIM}" login http://127.0.0.1:3000 --username=admin --email=admin@coder.com --password="${password}" ||
69+
"${CODER_DEV_SHIM}" login http://127.0.0.1:3000 --first-user-username=admin --first-user-email=admin@coder.com --first-user-password="${password}" ||
7070
echo 'Failed to create admin user. To troubleshoot, try running this command manually.'
7171

7272
# Try to create a regular user.

0 commit comments

Comments
 (0)