-
Notifications
You must be signed in to change notification settings - Fork 112
vt: set toml file mod #117
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
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
@plusvic I can certainly agree to a cla, but this repo has neither a security.md nor a contributing.md? |
vt/main.go
Outdated
| cfg = filepath.Join(home, ".vt.toml") | ||
| } | ||
|
|
||
| if _, err := os.Stat(cfg); os.IsNotExist(err) { |
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.
I don't think this should be done here. I would put this in the init command, where the .vt.toml file is initially created.
Line 92 in eb5dbbc
| configFile, err := os.Create(configFilePath) |
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.
would we still know where the config path is from though? the current solution grabs the correct path from the lib (maybe this is an upstream issue anyways?)
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.
I say that because it seems as if the path may be configured through command line args?
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 path for the config file is always the user's home directory. My concern with the proposed change is that the file permissions are set on every execution of the tool, and the file is created if it doesn't exist. This shouldn't be tool's behavior in my opinion. The config file should be created only when the init command is executed, and I agree on setting 0600 permissions when the file is initially created, as it contains the user's API key and it shouldn't be visible to other others.
However, if the user later decides to change the initial permissions for whatever reason, the tool shouldn't be enforcing 0600 permission every time it runs.
… of the tool. Set 0600 permissions when the file is originally created. From that moment, if the user decides to change the initial permissions, the tool should not be messing up with manually assigned permissions. Also the tool should not create a `.vt.toml` file if it doesn't exist, except when the `init` command is run.
Set 0600 as the mode for the config file.