-
Notifications
You must be signed in to change notification settings - Fork 887
feat: Generate random admin user password in dev mode #1207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Generate random admin user password in dev mode #1207
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Codecov Report
@@ Coverage Diff @@
## main #1207 +/- ##
==========================================
- Coverage 66.25% 66.09% -0.16%
==========================================
Files 265 265
Lines 16681 16771 +90
Branches 157 157
==========================================
+ Hits 11052 11085 +33
- Misses 4484 4527 +43
- Partials 1145 1159 +14
Continue to review full report at Codecov.
|
cli/server_test.go
Outdated
|
||
wantEmail := "myadmin@coder.com" | ||
wantPassword := "testpass42" | ||
os.Setenv("CODER_DEV_ADMIN_EMAIL", wantEmail) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
t.Setenv
handles this for you :-)
cli/server_test.go
Outdated
root.SetOutput(&stdoutBuf) | ||
var buf strings.Builder | ||
root.SetOutput(&buf) | ||
done := make(chan struct{}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: another way to do this is to use sync.WaitGroup
:
var wg sync.WaitGroup
go myFunc() {
... stuff happens
wg.Done()
}()
wg.Add(1)
wg.Wait()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The frontend change looks fine to me!
* feat: Generate random admin user password in dev mode * Add dev mode test with email/pass from env * Set email/pass for playwright e2e test via cli flags
This PR replaces the static dev mode admin password with a randomly generated one. It allows both email and password to be set either via environment or command line flags.
Normally passwords as cli flags is suboptimal, but considering the use case I think it's acceptable and may be nicer for the developer.
This PR also fixes a flake in the TestServer/Development test.
Closes #825