mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-03-13 12:48:56 -04:00
Merge pull request #17 from owncloud/feature/update-namespace
Http Namespace Flag
This commit is contained in:
@@ -38,6 +38,7 @@ func Server(cfg *config.Config) cli.Command {
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
logger := NewLogger(cfg)
|
||||
httpNamespace := c.String("http-namespace")
|
||||
|
||||
if cfg.Tracing.Enabled {
|
||||
switch t := cfg.Tracing.Type; t {
|
||||
@@ -135,6 +136,7 @@ func Server(cfg *config.Config) cli.Command {
|
||||
server, err := http.Server(
|
||||
http.Logger(logger),
|
||||
http.Context(ctx),
|
||||
http.Namespace(httpNamespace),
|
||||
http.Config(cfg),
|
||||
http.Metrics(metrics),
|
||||
http.Flags(flagset.RootWithConfig(cfg)),
|
||||
|
||||
@@ -37,7 +37,8 @@ type Asset struct {
|
||||
|
||||
// Phoenix defines the available phoenic configuration.
|
||||
type Phoenix struct {
|
||||
Path string
|
||||
Path string
|
||||
Namespace string
|
||||
}
|
||||
|
||||
// Config combines all available configuration parts.
|
||||
|
||||
@@ -141,5 +141,12 @@ func ServerWithConfig(cfg *config.Config) []cli.Flag {
|
||||
EnvVar: "PHOENIX_WEB_CONFIG",
|
||||
Destination: &cfg.Phoenix.Path,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "http-namespace",
|
||||
Value: "com.owncloud",
|
||||
Usage: "Set the base namespace for the http namespace",
|
||||
EnvVar: "PHOENIX_NAMESPACE",
|
||||
Destination: &cfg.Phoenix.Namespace,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,11 +14,12 @@ type Option func(o *Options)
|
||||
|
||||
// Options defines the available options for this package.
|
||||
type Options struct {
|
||||
Logger log.Logger
|
||||
Context context.Context
|
||||
Config *config.Config
|
||||
Metrics *metrics.Metrics
|
||||
Flags []cli.Flag
|
||||
Logger log.Logger
|
||||
Context context.Context
|
||||
Config *config.Config
|
||||
Metrics *metrics.Metrics
|
||||
Flags []cli.Flag
|
||||
Namespace string
|
||||
}
|
||||
|
||||
// newOptions initializes the available default options.
|
||||
@@ -66,3 +67,10 @@ func Flags(val []cli.Flag) Option {
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,8 +13,8 @@ func Server(opts ...Option) (http.Service, error) {
|
||||
|
||||
service := http.NewService(
|
||||
http.Logger(options.Logger),
|
||||
http.Namespace("go.micro.web"),
|
||||
http.Name("phoenix"),
|
||||
http.Namespace(options.Namespace),
|
||||
http.Name("web.phoenix"),
|
||||
http.Version(version.String),
|
||||
http.Address(options.Config.HTTP.Addr),
|
||||
http.Context(options.Context),
|
||||
|
||||
Reference in New Issue
Block a user