Skip to content

Conversation

@maraino
Copy link
Contributor

@maraino maraino commented Jul 26, 2023

Description

This commit changes the initialization of the STEPPATH to an Init function instead of doing it at the start using Go's init function.

It also removes the mkdir of STEPPATH. If necessary, commands like "step ca bootstrap" or "step ca init" will create the directory.

step and step-ca should call step.Init() at the start and fail if an error is returned. We might need to change other tools too.

Commands that create files in the STEPPATH or in a step context should create the directory if it doesn't exist. Main commands like step ca bootstrap and step ca init already do that.

This commit changes the initialization of the STEPPATH to an Init
function instead of doing it at the start using Go's init function.

It also removes the mkdir of STEPPATH. If necessary, commands like
"step ca bootstrap" or "step ca init" will create the directory.
Copy link
Member

@hslatman hslatman left a comment

Choose a reason for hiding this comment

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

Does it make sense to add a helper for the mkdir operation, to be called after Init()?

Other than that looks good

@maraino
Copy link
Contributor Author

maraino commented Jul 27, 2023

Does it make sense to add a helper for the mkdir operation, to be called after Init()?

I added that initially, but I removed it after not seeing an operation that writes files there that do not do MkdirAll. I can add it back, @hslatman what do you think?

@hslatman
Copy link
Member

Might be handy to add, just in case, for future use cases. It would make this Init and the fact that the dir(s) have to be created by the implementer a bit more discoverable/documented.

Given that you mention you didn't find a code path that didn't already do it, it's probably OK to merge this one and add the helper in a follow up.

@maraino maraino merged commit 3982f90 into main Jul 27, 2023
@maraino maraino deleted the step-init branch July 27, 2023 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants