commit 5550c4148e91f5b1cdc4a552b6ece42caa4fc5e8
parent e5aa08ff0c6498933ba6d0a1e8de2190cd1dc766
Author: Krisztián Szabó <krisztian.szabo@netlife.hu>
Date: Sat, 28 Dec 2013 20:37:44 +0100
Added append-port flag
Diffstat:
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/commands/server.go b/commands/server.go
@@ -23,10 +23,12 @@ import (
var serverPort int
var serverWatch bool
+var serverAppend bool
func init() {
serverCmd.Flags().IntVarP(&serverPort, "port", "p", 1313, "port to run the server on")
serverCmd.Flags().BoolVarP(&serverWatch, "watch", "w", false, "watch filesystem for changes and recreate as needed")
+ serverCmd.Flags().BoolVarP(&serverAppend, "append-port", "", true, "append port to baseurl")
}
var serverCmd = &cobra.Command{
@@ -49,7 +51,11 @@ func server(cmd *cobra.Command, args []string) {
BaseUrl = "http://" + BaseUrl
}
- Config.BaseUrl = strings.TrimSuffix(BaseUrl, "/") + ":" + strconv.Itoa(serverPort)
+ if serverAppend {
+ Config.BaseUrl = strings.TrimSuffix(BaseUrl, "/") + ":" + strconv.Itoa(serverPort)
+ } else {
+ Config.BaseUrl = strings.TrimSuffix(BaseUrl, "/")
+ }
build(serverWatch)