mirror of
https://github.com/nestriness/nestri.git
synced 2025-12-12 08:45:38 +02:00
This adds a simple way to incorporate a centralized authentication flow. The idea is to have the user, API and SSH (for machine authentication) all in one place using `openauthjs` + `SST` We also have a database now :) > We are using InstantDB as it allows us to authenticate a use with just the email. Plus it is super simple simple to use _of course after the initial fumbles trying to design the db and relationships_
51 lines
1.2 KiB
Go
51 lines
1.2 KiB
Go
package cmd
|
|
|
|
import (
|
|
"runtime/debug"
|
|
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var rootCmd = &cobra.Command{
|
|
Use: "nestri",
|
|
Short: "A CLI tool to run and manage your self-hosted cloud gaming service",
|
|
Args: cobra.NoArgs,
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
return cmd.Help()
|
|
},
|
|
}
|
|
|
|
// Execute adds all child commands to the root command and sets flags appropriately.
|
|
// This is called by main.main(). It only needs to happen once to the rootCmd.
|
|
func Execute() error {
|
|
err := rootCmd.Execute()
|
|
return err
|
|
}
|
|
|
|
var (
|
|
// Version stores the build version of VHS at the time of package through
|
|
// -ldflags.
|
|
//
|
|
// go build -ldflags "-s -w -X=main.Version=$(VERSION)"
|
|
Version string
|
|
|
|
// CommitSHA stores the git commit SHA at the time of package through -ldflags.
|
|
CommitSHA string
|
|
)
|
|
|
|
func init() {
|
|
rootCmd.AddCommand(runCmd)
|
|
if len(CommitSHA) >= 7 { //nolint:gomnd
|
|
vt := rootCmd.VersionTemplate()
|
|
rootCmd.SetVersionTemplate(vt[:len(vt)-1] + " (" + CommitSHA[0:7] + ")\n")
|
|
}
|
|
if Version == "" {
|
|
if info, ok := debug.ReadBuildInfo(); ok && info.Main.Sum != "" {
|
|
Version = info.Main.Version
|
|
} else {
|
|
Version = "unknown (built from source)"
|
|
}
|
|
}
|
|
rootCmd.Version = Version
|
|
}
|