Skip to content
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

allow setting of Master Password via Environment Variable #57

Closed

Conversation

dannyfast
Copy link

Linking issue #56

Danny Fast added 2 commits August 18, 2022 09:57
cmd/gokey/main.go Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
cmd/gokey/main.go Outdated Show resolved Hide resolved
cmd/gokey/main.go Outdated Show resolved Hide resolved
@@ -82,6 +83,22 @@ func TestGetPass(t *testing.T) {
if (strings.Compare(pass1Example1, pass1Example1Retry) != 0) || (strings.Compare(pass1Example1Seed1, pass1Example1Seed1Retry) != 0) {
t.Fatal("passwords with same invocation options do not match")
}

// Testing GOKEY_MASTER environment variable
os.Setenv("GOKEY_MASTER", "pass1")
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this test is useless, because we're not exercising the code from the cmdline utility at all. This test just goes through the library functions, but env handling is done via cmdline tool.

I think we need a different test here, which invokes gokey tool twice:

  • once specifying the password on the cmdline and
  • once specifying the password in env variable
    and compare the results

Copy link
Author

Choose a reason for hiding this comment

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

If there is a pattern to run sub-process commands within a testing scope or run I suppose that would be one option. I am not aware of others.

Copy link
Contributor

Choose a reason for hiding this comment

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

we can probably add commands directly to https://github.com/cloudflare/gokey/blob/main/.github/workflows/ci.yml (we would need to compile the cmdline tool first anyway)

Copy link
Contributor

Choose a reason for hiding this comment

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

We still haven't resolved this

@ignatk
Copy link
Contributor

ignatk commented Sep 2, 2022

can you also, please, rebase your branch as I've fixed the tests for >= Go 1.19 in #59 ?

@dannyfast dannyfast force-pushed the dannyfast-set-master-pw-via-env-var branch from 9954045 to 3b5ee8f Compare December 30, 2022 17:58
@dannyfast
Copy link
Author

Rebased.

keygen.go Outdated Show resolved Hide resolved
@dannyfast
Copy link
Author

Ready for review. Thank you for the suggestions and corrections.

@dannyfast
Copy link
Author

Corrected the go.mod.

reverted chars to use upper/lower
@dannyfast dannyfast requested a review from ignatk July 17, 2023 14:11
Copy link
Contributor

@ignatk ignatk left a comment

Choose a reason for hiding this comment

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

let's add a cmdline test testing the feature

@dantefromhell
Copy link

@dannyfast Thanks a ton for taking this on, exactly the feature I needed 👍🏽

Is this already functional of your branch?

@ignatk
Copy link
Contributor

ignatk commented Apr 29, 2024

Moved and updated the code in #72:

  • changed the environment variable name to GOKEY_ROOT_PASS
  • added some tests, which actually exercise the command line utility for various password sources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants