-
Notifications
You must be signed in to change notification settings - Fork 45
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
Fix/privacyjson #1379
Fix/privacyjson #1379
Conversation
This commit add a new pkg called privacyconfig. The code from cli config private is moved in this pkg and is then also used by the API's SetPrivacy and GetPrivacy. We fix the API by removing the script code and use funcs privacyconfig.SetReward and privacyconfig.GetReward.
This commit changes the lowercase vairables to use cammel case instead to keep the consistency of the codebase following the basic Naming Rules and Conventions of golang.
This commit changes how the structs are initilized as per the guidleines used in the skywire project.
This commit removes the param pathStr from SetReward because it is no longer needed.
Update config priv subcommands set and get to use flags output, pkg and user that are used by main config instead of using it's own set of flags in order to have the functionality be the same.
Output flags now behave like the output flags in |
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've noticed a lot of improvements and streamlining of the cli command code as compared to my initial work. Very good.
One thing I will just note ; on the flags for skywire-cli config priv
we are again in a situation where, no matter what permissions you have, you shouldn't use one of the two flags (-p
or -u
). Either you won't be able to write the file if you use the -p
flag without root or you will create a root-owned file in the userspace using the -u
flag as root
for skywire-cli config gen
those flags do more than just set the output path, they set paths in the config used by the visor. Additionally, the output path of the skywire config can be overridden with the -o flag, by design.
Since we don't have such considerations in this instance, would it not be better either as I had it before, or with the config being written to the correct path for the current permissions?
The package is basically the point where we can facilitate running skywire at the user level, and it does not exactly support this currently. So it's actually just extra complexity in the config priv subcommand.
most people will use either the hypervisor UI to set this file or the visor. At the point it's done from the visor, the current local path is used, which the visor in theory has permissions for.
I am going to use the skywire-cli config priv
subcommand. I may make a script that will use it too, so I would like the simple and intuitive implementation that writes to the only local path that is really used currently in the packages.
Did you run
make format && make check
?Fixes #1361
Changes:
How to test this PR:
./skywire-cli config priv get
./skywire-cli config priv get --json
./skywire-cli config priv set
./skywire-cli config priv set --json
./skywire-cli visor priv get
./skywire-cli visor priv get --json
./skywire-cli visor priv set
./skywire-cli visor priv set --json
http://localhost:8000/api/visors/<pk>/privacy
http://localhost:8000/api/visors/<pk>/privacy
with body