mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-30 15:40:05 +03:00
all: Unify case of config variable names
All config variables starts with low-case and uses camelCase. If there is abbreviation at the beginning of the name, the whole abbreviation will be written in low-case. If there is abbreviation at the end of the name, the whole abbreviation will be written in upper-case. For example, rssURI.
This commit is contained in:
parent
d9f54a13c1
commit
f21e2f25c9
67 changed files with 469 additions and 469 deletions
|
@ -90,7 +90,7 @@ func init() {
|
|||
serverCmd.Flags().IntVarP(&serverPort, "port", "p", 1313, "port on which the server will listen")
|
||||
serverCmd.Flags().StringVarP(&serverInterface, "bind", "", "127.0.0.1", "interface to which the server will bind")
|
||||
serverCmd.Flags().BoolVarP(&serverWatch, "watch", "w", true, "watch filesystem for changes and recreate as needed")
|
||||
serverCmd.Flags().BoolVarP(&serverAppend, "appendPort", "", true, "append port to baseurl")
|
||||
serverCmd.Flags().BoolVarP(&serverAppend, "appendPort", "", true, "append port to baseURL")
|
||||
serverCmd.Flags().BoolVar(&disableLiveReload, "disableLiveReload", false, "watch without enabling live browser reload on rebuild")
|
||||
serverCmd.Flags().BoolVar(&renderToDisk, "renderToDisk", false, "render to Destination path (default is render to memory & serve from there)")
|
||||
serverCmd.Flags().String("memstats", "", "log memory usage to this file")
|
||||
|
@ -109,11 +109,11 @@ func server(cmd *cobra.Command, args []string) error {
|
|||
}
|
||||
|
||||
if flagChanged(cmd.Flags(), "disableLiveReload") {
|
||||
viper.Set("DisableLiveReload", disableLiveReload)
|
||||
viper.Set("disableLiveReload", disableLiveReload)
|
||||
}
|
||||
|
||||
if serverWatch {
|
||||
viper.Set("Watch", true)
|
||||
viper.Set("watch", true)
|
||||
}
|
||||
|
||||
if viper.GetBool("watch") {
|
||||
|
@ -139,11 +139,11 @@ func server(cmd *cobra.Command, args []string) error {
|
|||
|
||||
viper.Set("port", serverPort)
|
||||
|
||||
BaseURL, err := fixURL(baseURL)
|
||||
baseURL, err = fixURL(baseURL)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
viper.Set("BaseURL", BaseURL)
|
||||
viper.Set("baseURL", baseURL)
|
||||
|
||||
if err := memStats(); err != nil {
|
||||
jww.ERROR.Println("memstats error:", err)
|
||||
|
@ -158,7 +158,7 @@ func server(cmd *cobra.Command, args []string) error {
|
|||
if !renderToDisk {
|
||||
hugofs.SetDestination(new(afero.MemMapFs))
|
||||
// Rendering to memoryFS, publish to Root regardless of publishDir.
|
||||
viper.Set("PublishDir", "/")
|
||||
viper.Set("publishDir", "/")
|
||||
}
|
||||
|
||||
if err := build(serverWatch); err != nil {
|
||||
|
@ -168,7 +168,7 @@ func server(cmd *cobra.Command, args []string) error {
|
|||
// Watch runs its own server as part of the routine
|
||||
if serverWatch {
|
||||
watchDirs := getDirList()
|
||||
baseWatchDir := viper.GetString("WorkingDir")
|
||||
baseWatchDir := viper.GetString("workingDir")
|
||||
for i, dir := range watchDirs {
|
||||
watchDirs[i], _ = helpers.GetRelativePath(dir, baseWatchDir)
|
||||
}
|
||||
|
@ -190,19 +190,19 @@ func server(cmd *cobra.Command, args []string) error {
|
|||
|
||||
func serve(port int) {
|
||||
if renderToDisk {
|
||||
jww.FEEDBACK.Println("Serving pages from " + helpers.AbsPathify(viper.GetString("PublishDir")))
|
||||
jww.FEEDBACK.Println("Serving pages from " + helpers.AbsPathify(viper.GetString("publishDir")))
|
||||
} else {
|
||||
jww.FEEDBACK.Println("Serving pages from memory")
|
||||
}
|
||||
|
||||
httpFs := afero.NewHttpFs(hugofs.Destination())
|
||||
fs := filesOnlyFs{httpFs.Dir(helpers.AbsPathify(viper.GetString("PublishDir")))}
|
||||
fs := filesOnlyFs{httpFs.Dir(helpers.AbsPathify(viper.GetString("publishDir")))}
|
||||
fileserver := http.FileServer(fs)
|
||||
|
||||
// We're only interested in the path
|
||||
u, err := url.Parse(viper.GetString("BaseURL"))
|
||||
u, err := url.Parse(viper.GetString("baseURL"))
|
||||
if err != nil {
|
||||
jww.ERROR.Fatalf("Invalid BaseURL: %s", err)
|
||||
jww.ERROR.Fatalf("Invalid baseURL: %s", err)
|
||||
}
|
||||
if u.Path == "" || u.Path == "/" {
|
||||
http.Handle("/", fileserver)
|
||||
|
@ -221,12 +221,12 @@ func serve(port int) {
|
|||
}
|
||||
}
|
||||
|
||||
// fixURL massages the BaseURL into a form needed for serving
|
||||
// fixURL massages the baseURL into a form needed for serving
|
||||
// all pages correctly.
|
||||
func fixURL(s string) (string, error) {
|
||||
useLocalhost := false
|
||||
if s == "" {
|
||||
s = viper.GetString("BaseURL")
|
||||
s = viper.GetString("baseURL")
|
||||
useLocalhost = true
|
||||
}
|
||||
|
||||
|
@ -262,7 +262,7 @@ func fixURL(s string) (string, error) {
|
|||
if strings.Contains(u.Host, ":") {
|
||||
u.Host, _, err = net.SplitHostPort(u.Host)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("Failed to split BaseURL hostpost: %s", err)
|
||||
return "", fmt.Errorf("Failed to split baseURL hostpost: %s", err)
|
||||
}
|
||||
}
|
||||
u.Host += fmt.Sprintf(":%d", serverPort)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue