mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-29 23:12:10 -05:00
Added append-port flag
This commit is contained in:
parent
e5aa08ff0c
commit
5550c4148e
1 changed files with 7 additions and 1 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue