Add Namespace flag (#21)
* added http-namespace to the flagset * update description * added namespace option to the options list * added namespace as a config parameter * updated docs * fix default value override
This commit is contained in:
committed by
Jörn Friedrich Dreyer
parent
a0ebc35b80
commit
91e17d0cde
@@ -129,6 +129,9 @@ If you prefer to configure the service with commandline flags you can see the av
|
|||||||
--http-addr
|
--http-addr
|
||||||
: Address to bind http server, defaults to `0.0.0.0:9120`
|
: Address to bind http server, defaults to `0.0.0.0:9120`
|
||||||
|
|
||||||
|
--http-namespace
|
||||||
|
: Namespace for internal services communication, defaults to `com.owncloud.web`
|
||||||
|
|
||||||
--http-root
|
--http-root
|
||||||
: Root path of http server, defaults to `/`
|
: Root path of http server, defaults to `/`
|
||||||
|
|
||||||
|
|||||||
@@ -17,8 +17,9 @@ type Debug struct {
|
|||||||
|
|
||||||
// HTTP defines the available http configuration.
|
// HTTP defines the available http configuration.
|
||||||
type HTTP struct {
|
type HTTP struct {
|
||||||
Addr string
|
Addr string
|
||||||
Root string
|
Namespace string
|
||||||
|
Root string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tracing defines the available tracing configuration.
|
// Tracing defines the available tracing configuration.
|
||||||
|
|||||||
@@ -127,6 +127,13 @@ func ServerWithConfig(cfg *config.Config) []cli.Flag {
|
|||||||
EnvVar: "GRAPH_HTTP_ROOT",
|
EnvVar: "GRAPH_HTTP_ROOT",
|
||||||
Destination: &cfg.HTTP.Root,
|
Destination: &cfg.HTTP.Root,
|
||||||
},
|
},
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "http-namespace",
|
||||||
|
Value: "com.owncloud.web",
|
||||||
|
Usage: "Set the base namespace for the http service for service discovery",
|
||||||
|
EnvVar: "GRAPH_HTTP_NAMESPACE",
|
||||||
|
Destination: &cfg.HTTP.Namespace,
|
||||||
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "ldap-network",
|
Name: "ldap-network",
|
||||||
Value: "tcp",
|
Value: "tcp",
|
||||||
|
|||||||
@@ -14,11 +14,12 @@ type Option func(o *Options)
|
|||||||
|
|
||||||
// Options defines the available options for this package.
|
// Options defines the available options for this package.
|
||||||
type Options struct {
|
type Options struct {
|
||||||
Logger log.Logger
|
Logger log.Logger
|
||||||
Context context.Context
|
Context context.Context
|
||||||
Config *config.Config
|
Config *config.Config
|
||||||
Metrics *metrics.Metrics
|
Metrics *metrics.Metrics
|
||||||
Flags []cli.Flag
|
Flags []cli.Flag
|
||||||
|
Namespace string
|
||||||
}
|
}
|
||||||
|
|
||||||
// newOptions initializes the available default options.
|
// newOptions initializes the available default options.
|
||||||
@@ -66,3 +67,10 @@ func Flags(val []cli.Flag) Option {
|
|||||||
o.Flags = append(o.Flags, val...)
|
o.Flags = append(o.Flags, val...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Namespace provides a function to set the Namespace option.
|
||||||
|
func Namespace(val string) Option {
|
||||||
|
return func(o *Options) {
|
||||||
|
o.Namespace = val
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ func Server(opts ...Option) (http.Service, error) {
|
|||||||
|
|
||||||
service := http.NewService(
|
service := http.NewService(
|
||||||
http.Logger(options.Logger),
|
http.Logger(options.Logger),
|
||||||
http.Namespace("go.micro.web"),
|
http.Namespace(options.Config.HTTP.Namespace),
|
||||||
http.Name("graph"),
|
http.Name("graph"),
|
||||||
http.Version(version.String),
|
http.Version(version.String),
|
||||||
http.Address(options.Config.HTTP.Addr),
|
http.Address(options.Config.HTTP.Addr),
|
||||||
|
|||||||
Reference in New Issue
Block a user