Add whoami command to peach-config #128
No reviewers
Labels
No Label
bug
documentation
duplicate
enhancement
help wanted
invalid
maintenance
peach-lib
peach-network
peach-oled
peach-stats
peach-web
question
refactor
wontfix
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: PeachCloud/peach-workspace#128
Loading…
Reference in New Issue
No description provided.
Delete Branch "who-am-i"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This command can be used during the yunohost install to check if the sbot is running (and wait for it to start running).
I copied over init_sbot from peach-web/src/utils/sbot.rs.
It might make sense for init_sbot to only be defined in peach-lib, and for peach-web to import it from there, but perhaps that could be done as a separate PR.
The reason to define a whoami command here in peach-config, instead of make calls to go-sbot directly, is so that we can use the same configuration in peach-config (which really could be renamed peach-cli, as thats what it effectively is) that is used in peach-web, and so that we can use golgi functions.
Alternatively, we could add HTTP endpoints to peach-web which are specifically meant to be called from the command line such as
/whoami
/setdomain?domainvalue
but then we need to either let these endpoints be unauthenticated,
or in yunohost figure out how to authenticate via the command line, and then make calls to these endpoints (which also sounds complicated to me)
As mentioned in #127, I think there are better ways to check if the
sbot
is running. However, I do think it's useful to have awhoami
command as part ofpeach-config
(it provides a nice way to query the public key of the local instance).I think I'm fine with either option; would need to spend a bit of time looking at the code. I tend to lose clarity of the map after a while.
👍 (+1
peach-cli
)Agreed. Too complicated.
Implementation looks good to me. I left comments in the discussion thread.
🟢
Now that we are using Rouille for peach-web, I think we could quite easily move the contents of the main() function in peach-web/src/main into a run() funciton in peach-web/src/main.rs,
then import peach-web into peach-cli as a dependency,
and then use peach-web/src/main::run() as a "web" subcommand within peach-cli (as described here: #57)
this would allow us to have peach-cli and peach-web as one binary, with minimal work, which I think would be pretty cool (right now both peach-config and peach-web and go-sbot all get installed as binaries in a yunohost install)
I like testing via whoami because its a "full end-to-end test" -- its theoretically possibly go-sbot service could be running, but hanging for some reason, or not accepting connections, or not able to return results, for whatever reason, but if whoami returns a value, I feel pretty confident that it can also do the other stuff its supposed to do (I recall Lorentz mentioning that running whoami is also what planetary does as a health check for go-sbot to know when to restart it)
I've copied your comments about
peach-web
->peach-cli
into the relevant issue so we can keep track of it (#57 (comment)).Ah, OK, that makes sense. I didn't realise you wanted a health check.
👍