Rename the binary to allmende, add a Makefile with Bonn as default region
- cmd/node -> cmd/allmende; usage, messages and docs use the new name - Makefile: build, init, run (REGION defaults to u1j, Bonn), vet, test, web, web-test, check, clean Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -24,7 +24,7 @@ func cmdInit(args []string) error {
|
||||
fs.Parse(args)
|
||||
|
||||
if _, err := os.Stat(filepath.Join(*data, "device.key")); err == nil {
|
||||
return fmt.Errorf("%s is already set up. To get access back after losing this machine, use 'node recover'", *data)
|
||||
return fmt.Errorf("%s is already set up. To get access back after losing this machine, use 'allmende recover'", *data)
|
||||
}
|
||||
|
||||
root, phrase, err := identity.NewRoot()
|
||||
@@ -59,7 +59,7 @@ func cmdInit(args []string) error {
|
||||
|
||||
fmt.Printf("\nDone. This machine is set up as a device of identity %s…\n", dev.Cert.Author[:12])
|
||||
fmt.Printf("Your device certificate is valid until %s.\n\n", time.Unix(dev.Cert.ExpiresAt, 0).Format("2006-01-02"))
|
||||
fmt.Printf("Next: node run --region <region> --data %s\n", *data)
|
||||
fmt.Printf("Next: allmende run --region <region> --data %s\n", *data)
|
||||
fmt.Printf("The admin token for publishing is in %s\n", filepath.Join(*data, tokenFile))
|
||||
return nil
|
||||
}
|
||||
@@ -95,7 +95,7 @@ func confirmPhrase(in *bufio.Reader, words []string) error {
|
||||
fmt.Printf("Word number %d: ", i+1)
|
||||
line, err := in.ReadString('\n')
|
||||
if err != nil && (!errors.Is(err, io.EOF) || line == "") {
|
||||
return errors.New("no input; run 'node init' again in a terminal")
|
||||
return errors.New("no input; run 'allmende init' again in a terminal")
|
||||
}
|
||||
if strings.EqualFold(strings.TrimSpace(line), words[i]) {
|
||||
break
|
||||
@@ -1,8 +1,8 @@
|
||||
// Command node runs an Allmende node.
|
||||
// Command allmende runs an Allmende node.
|
||||
//
|
||||
// node init first-time setup: creates your identity and shows your recovery phrase
|
||||
// node run run the node (replicates listings, serves the HTTP API)
|
||||
// node recover restore from the recovery phrase after a lost or compromised machine
|
||||
// allmende init first-time setup: creates your identity and shows your recovery phrase
|
||||
// allmende run run the node (replicates listings, serves the HTTP API)
|
||||
// allmende recover restore from the recovery phrase after a lost or compromised machine
|
||||
package main
|
||||
|
||||
import (
|
||||
@@ -26,11 +26,11 @@ const (
|
||||
const usage = `Allmende: a free, distributed marketplace for homes.
|
||||
|
||||
Usage:
|
||||
node init [--data DIR] create your identity (first run)
|
||||
node run [--data DIR] --region u1x run the node
|
||||
node recover [--data DIR] restore access using your recovery phrase
|
||||
allmende init [--data DIR] create your identity (first run)
|
||||
allmende run [--data DIR] --region u1x run the node
|
||||
allmende recover [--data DIR] restore access using your recovery phrase
|
||||
|
||||
Run "node <command> -h" for the options of a command.
|
||||
Run "allmende <command> -h" for the options of a command.
|
||||
`
|
||||
|
||||
func main() {
|
||||
@@ -103,7 +103,7 @@ func cmdRecover(args []string) error {
|
||||
time.Unix(dev.Cert.ExpiresAt, 0).Format("2006-01-02"))
|
||||
fmt.Printf(" - %d of your listings were re-signed from this device.\n", republished)
|
||||
fmt.Println(" - A new admin token was written; the old one no longer works.")
|
||||
fmt.Println("\nStart the node with 'node run' so the revocation spreads through the network.")
|
||||
fmt.Println("\nStart the node with 'allmende run' so the revocation spreads through the network.")
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -53,17 +53,17 @@ func cmdRun(args []string) error {
|
||||
dev, err := identity.LoadDevice(*data)
|
||||
if err != nil {
|
||||
if errors.Is(err, os.ErrNotExist) {
|
||||
return fmt.Errorf("%s is not set up yet: run 'node init' first", *data)
|
||||
return fmt.Errorf("%s is not set up yet: run 'allmende init' first", *data)
|
||||
}
|
||||
return err
|
||||
}
|
||||
until := time.Until(time.Unix(dev.Cert.ExpiresAt, 0))
|
||||
if until <= 0 {
|
||||
return errors.New("this device's certificate has expired; run 'node recover' to renew it")
|
||||
return errors.New("this device's certificate has expired; run 'allmende recover' to renew it")
|
||||
}
|
||||
log := slog.New(slog.NewTextHandler(os.Stderr, nil))
|
||||
if until < certWarnBefore {
|
||||
log.Warn("device certificate expires soon; run 'node recover' to renew it",
|
||||
log.Warn("device certificate expires soon; run 'allmende recover' to renew it",
|
||||
"expires", time.Unix(dev.Cert.ExpiresAt, 0).Format("2006-01-02"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user