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

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

mafredri
Copy link
Member

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

johnstcn reacted with hooray emoji
@mafredrimafredri self-assigned thisApr 28, 2022
@mafredrimafredri requested review fromammario,coadler,johnstcn anda teamApril 28, 2022 14:17
Copy link
Member

@kylecarbskylecarbs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM!

@codecov
Copy link

codecovbot commentedApr 28, 2022
edited
Loading

Codecov Report

Merging#1207 (0026a12) intomain (a7fb018) willdecrease coverage by0.15%.
The diff coverage is71.87%.

@@            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
FlagCoverage Δ
unittest-go-macos-latest53.39% <71.87%> (-0.32%)⬇️
unittest-go-postgres-65.45% <71.87%> (-0.09%)⬇️
unittest-go-ubuntu-latest55.91% <71.87%> (-0.17%)⬇️
unittest-go-windows-202253.07% <71.87%> (-0.08%)⬇️
unittest-js66.50% <ø> (ø)
Impacted FilesCoverage Δ
cli/server.go58.77% <71.87%> (-0.15%)⬇️
pty/start_other.go64.70% <0.00%> (-23.53%)⬇️
codersdk/provisionerdaemons.go61.97% <0.00%> (-5.64%)⬇️
coderd/users.go61.27% <0.00%> (-2.01%)⬇️
provisionerd/provisionerd.go76.84% <0.00%> (-0.67%)⬇️
coderd/database/queries.sql.go81.12% <0.00%> (-0.54%)⬇️
coderd/provisionerdaemons.go63.29% <0.00%> (-0.51%)⬇️
peer/conn.go79.44% <0.00%> (ø)
codersdk/users.go64.20% <0.00%> (ø)
peerbroker/proxy.go58.72% <0.00%> (+0.58%)⬆️
... and3 more

Continue to review full report at Codecov.

Legend -Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing data
Powered byCodecov. Last updatea7fb018...0026a12. Read thecomment docs.


wantEmail := "myadmin@coder.com"
wantPassword := "testpass42"
os.Setenv("CODER_DEV_ADMIN_EMAIL", wantEmail)
Copy link
Member

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 :-)

kylecarbs reacted with thumbs up emojimafredri reacted with hooray emoji
root.SetOutput(&stdoutBuf)
var buf strings.Builder
root.SetOutput(&buf)
done := make(chan struct{})
Copy link
Member

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 usesync.WaitGroup:

var wg sync.WaitGroupgo myFunc() {    ... stuff happens   wg.Done()}()wg.Add(1)wg.Wait()

mafredri and coadler reacted with thumbs up emoji
Copy link
Member

@johnstcnjohnstcn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Nice work!

@mafredrimafredri requested a review froma team as acode ownerApril 28, 2022 14:53
Copy link
Contributor

@presleyppresleyp left a 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!

mafredri reacted with hooray emoji
@mafredrimafredri merged commitafc43fe intomainApr 28, 2022
@mafredrimafredri deleted the mafredri/feat-generate-random-dev-user-password branchApril 28, 2022 16:13
@missknissmisskniss added this to theV2 Beta milestoneMay 15, 2022
kylecarbs pushed a commit that referenced this pull requestJun 10, 2022
* 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
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@presleyppresleyppresleyp approved these changes

@johnstcnjohnstcnjohnstcn approved these changes

@coadlercoadlercoadler approved these changes

@kylecarbskylecarbskylecarbs approved these changes

@greyscaledgreyscaledgreyscaled approved these changes

@ammarioammarioAwaiting requested review from ammario

Assignees

@mafredrimafredri

Labels
None yet
Projects
None yet
Milestone
V2 Beta
Development

Successfully merging this pull request may close these issues.

dev mode launches with no credentials printed to console
7 participants
@mafredri@presleyp@johnstcn@coadler@kylecarbs@greyscaled@misskniss

[8]ページ先頭

©2009-2025 Movatter.jp