mirror of
https://github.com/davidallendj/configurator.git
synced 2025-12-20 03:27:02 -07:00
cmd: updated --host flag and removed --port
This commit is contained in:
parent
8f23422db0
commit
e3a8461828
2 changed files with 8 additions and 10 deletions
|
|
@ -50,8 +50,9 @@ var generateCmd = &cobra.Command{
|
||||||
if verbose {
|
if verbose {
|
||||||
b, err := json.MarshalIndent(conf, "", " ")
|
b, err := json.MarshalIndent(conf, "", " ")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("failed to marshal conf: %v\n", err)
|
log.Error().Err(err).Printf("failed to marshal config")
|
||||||
}
|
}
|
||||||
|
// print the config file as JSON
|
||||||
fmt.Printf("%v\n", string(b))
|
fmt.Printf("%v\n", string(b))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -92,17 +93,17 @@ var generateCmd = &cobra.Command{
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate files by supplying a list of targets as string values. Currently,
|
// Generate files by supplying a list of targets as string values. Currently,
|
||||||
// targets are defined statically in a conf file. Targets are ran recursively
|
// targets are defined statically in a config file. Targets are ran recursively
|
||||||
// if more targets are nested in a defined target, but will not run additional
|
// if more targets are nested in a defined target, but will not run additional
|
||||||
// child targets if it is the same as the parent.
|
// child targets if it is the same as the parent.
|
||||||
//
|
//
|
||||||
// NOTE: This may be changed in the future how this is done.
|
// NOTE: This may be changed in the future how this is done.
|
||||||
func RunTargets(conf *config.Config, args []string, targets ...string) {
|
func RunTargets(conf *config.Config, args []string, targets ...string) {
|
||||||
// generate conf with each supplied target
|
// generate config with each supplied target
|
||||||
for _, target := range targets {
|
for _, target := range targets {
|
||||||
outputBytes, err := generator.GenerateWithTarget(conf, target)
|
outputBytes, err := generator.GenerateWithTarget(conf, target)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error().Err(err).Msg("failed to generate conf")
|
log.Error().Err(err).Msg("failed to generate config")
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ var serveCmd = &cobra.Command{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// show conf as JSON and generators if verbose
|
// show config as JSON and generators if verbose
|
||||||
if verbose {
|
if verbose {
|
||||||
b, err := json.MarshalIndent(conf, "", "\t")
|
b, err := json.MarshalIndent(conf, "", "\t")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -44,9 +44,7 @@ var serveCmd = &cobra.Command{
|
||||||
// set up the routes and start the serve
|
// set up the routes and start the serve
|
||||||
server := server.Server{
|
server := server.Server{
|
||||||
Config: &conf,
|
Config: &conf,
|
||||||
Server: &http.Server{
|
Server: &http.Server{Addr: conf.Server.Host},
|
||||||
Addr: fmt.Sprintf("%s:%d", conf.Server.Host, conf.Server.Port),
|
|
||||||
},
|
|
||||||
Jwks: server.Jwks{
|
Jwks: server.Jwks{
|
||||||
Uri: conf.Server.Jwks.Uri,
|
Uri: conf.Server.Jwks.Uri,
|
||||||
Retries: conf.Server.Jwks.Retries,
|
Retries: conf.Server.Jwks.Retries,
|
||||||
|
|
@ -67,8 +65,7 @@ var serveCmd = &cobra.Command{
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
serveCmd.Flags().StringVar(&conf.Server.Host, "host", conf.Server.Host, "set the server host")
|
serveCmd.Flags().StringVar(&conf.Server.Host, "host", conf.Server.Host, "set the server host and port")
|
||||||
serveCmd.Flags().IntVar(&conf.Server.Port, "port", conf.Server.Port, "set the server port")
|
|
||||||
// serveCmd.Flags().StringVar(&pluginPath, "plugin", "", "set the generator plugins directory path")
|
// serveCmd.Flags().StringVar(&pluginPath, "plugin", "", "set the generator plugins directory path")
|
||||||
serveCmd.Flags().StringVar(&conf.Server.Jwks.Uri, "jwks-uri", conf.Server.Jwks.Uri, "set the JWKS url to fetch public key")
|
serveCmd.Flags().StringVar(&conf.Server.Jwks.Uri, "jwks-uri", conf.Server.Jwks.Uri, "set the JWKS url to fetch public key")
|
||||||
serveCmd.Flags().IntVar(&conf.Server.Jwks.Retries, "jwks-fetch-retries", conf.Server.Jwks.Retries, "set the JWKS fetch retry count")
|
serveCmd.Flags().IntVar(&conf.Server.Jwks.Retries, "jwks-fetch-retries", conf.Server.Jwks.Retries, "set the JWKS fetch retry count")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue