Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pkg/cmd: root programName and share ExampleServe
- Loading branch information
1 parent
f94d8a4
commit bf16cc0
Showing
4 changed files
with
32 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,22 @@ | ||
package root | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/fatih/color" | ||
"github.com/jzelinskie/cobrautil" | ||
"github.com/spf13/cobra" | ||
|
||
cmdutil "github.com/authzed/spicedb/pkg/cmd" | ||
) | ||
|
||
func RegisterFlags(cmd *cobra.Command) { | ||
cobrautil.RegisterZeroLogFlags(cmd.PersistentFlags(), "log") | ||
cobrautil.RegisterOpenTelemetryFlags(cmd.PersistentFlags(), "otel", cmd.Use) | ||
} | ||
|
||
func NewCommand() *cobra.Command { | ||
func NewCommand(programName string) *cobra.Command { | ||
return &cobra.Command{ | ||
Use: "spicedb", | ||
Short: "A modern permissions database", | ||
Long: "A database that stores, computes, and validates application permissions", | ||
Example: fmt.Sprintf(` %s: | ||
spicedb serve --grpc-preshared-key "somerandomkeyhere" | ||
%s: | ||
spicedb serve --grpc-preshared-key "realkeyhere" --grpc-tls-cert-path path/to/tls/cert --grpc-tls-key-path path/to/tls/key \ | ||
--http-tls-cert-path path/to/tls/cert --http-tls-key-path path/to/tls/key \ | ||
--datastore-engine postgres --datastore-conn-uri "postgres-connection-string-here" | ||
%s: | ||
spicedb serve-testing | ||
`, | ||
color.YellowString("No TLS and in-memory"), | ||
color.GreenString("TLS and a real datastore"), | ||
color.CyanString("In-memory integration test server"), | ||
), | ||
Use: programName, | ||
Short: "A modern permissions database", | ||
Long: "A database that stores, computes, and validates application permissions", | ||
Example: cmdutil.ServeExample(programName), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters