mirror of
https://github.com/cirruslabs/orchard.git
synced 2026-10-18 04:43:12 +02:00
Support for prefixed Orchard Controller API URLs (#355)
* Support for prefixed Orchard Controller API URLs * Fix Swagger UI * Remove spurious "fmt" import * Use url.URL in order to correctly calculate API path for Swagger UI
This commit is contained in:
@@ -24,6 +24,7 @@ import (
|
||||
var ErrRunFailed = errors.New("failed to run controller")
|
||||
|
||||
var address string
|
||||
var apiPrefix string
|
||||
var addressSSH string
|
||||
var addressPprof string
|
||||
var debug bool
|
||||
@@ -50,6 +51,9 @@ func newRunCommand() *cobra.Command {
|
||||
|
||||
cmd.Flags().StringVarP(&address, "listen", "l", fmt.Sprintf(":%s", port),
|
||||
"address to listen on")
|
||||
cmd.Flags().StringVar(&apiPrefix, "api-prefix", "",
|
||||
"prefix to prepend to all Orchard Controller API endpoints; useful when exposing Orchard Controller "+
|
||||
"behind an HTTP proxy together with other services")
|
||||
cmd.Flags().StringVar(&addressSSH, "listen-ssh", "",
|
||||
"address for the built-in SSH server to listen on (e.g. \":6122\")")
|
||||
cmd.Flags().StringVar(&addressPprof, "listen-pprof", "",
|
||||
@@ -144,6 +148,10 @@ func runController(cmd *cobra.Command, args []string) (err error) {
|
||||
controller.WithLogger(logger),
|
||||
}
|
||||
|
||||
if apiPrefix != "" {
|
||||
controllerOpts = append(controllerOpts, controller.WithAPIPrefix(apiPrefix))
|
||||
}
|
||||
|
||||
var controllerCert tls.Certificate
|
||||
|
||||
if !noTLS {
|
||||
|
||||
Reference in New Issue
Block a user