1
0
mirror of https://github.com/pocket-id/pocket-id.git synced 2026-02-06 14:13:01 +00:00

refactor: replace create-one-time-access-token script with in-app functionality (#540)

This commit is contained in:
Alessandro (Ale) Segala
2025-05-18 04:22:40 -07:00
committed by Elias Schneider
parent 35b227cd17
commit cb2a9f9f7d
8 changed files with 132 additions and 136 deletions

View File

@@ -1,11 +1,15 @@
package main
import (
"flag"
"fmt"
"log"
_ "time/tzdata"
"github.com/pocket-id/pocket-id/backend/internal/bootstrap"
"github.com/pocket-id/pocket-id/backend/internal/cmds"
"github.com/pocket-id/pocket-id/backend/internal/common"
)
// @title Pocket ID API
@@ -13,7 +17,26 @@ import (
// @description.markdown
func main() {
err := bootstrap.Bootstrap()
// Get the command
// By default, this starts the server
var cmd string
flag.Parse()
args := flag.Args()
if len(args) > 0 {
cmd = args[0]
}
var err error
switch cmd {
case "version":
fmt.Println("pocket-id " + common.Version)
case "one-time-access-token":
err = cmds.OneTimeAccessToken(args)
default:
// Start the server
err = bootstrap.Bootstrap()
}
if err != nil {
log.Fatal(err.Error())
}