Add cli arg for domain
This commit is contained in:
parent
b88fb1643c
commit
5615210be5
@ -8,6 +8,7 @@ import (
|
|||||||
|
|
||||||
type CliArgs struct {
|
type CliArgs struct {
|
||||||
DBName string
|
DBName string
|
||||||
|
Domain string
|
||||||
KeyFile string
|
KeyFile string
|
||||||
LogFile string
|
LogFile string
|
||||||
Port string
|
Port string
|
||||||
@ -21,6 +22,7 @@ func HandleCliArgs() (*CliArgs, error) {
|
|||||||
cliArgs := new(CliArgs)
|
cliArgs := new(CliArgs)
|
||||||
|
|
||||||
flag.StringVar(&cliArgs.DBName, "db", "cpolis", "DB name")
|
flag.StringVar(&cliArgs.DBName, "db", "cpolis", "DB name")
|
||||||
|
flag.StringVar(&cliArgs.Domain, "domain", "", "domain name")
|
||||||
keyFile := flag.String("key", "/var/www/cpolis/cpolis.key", "key file")
|
keyFile := flag.String("key", "/var/www/cpolis/cpolis.key", "key file")
|
||||||
logFile := flag.String("log", "/var/log/cpolis.log", "log file")
|
logFile := flag.String("log", "/var/log/cpolis.log", "log file")
|
||||||
flag.StringVar(&cliArgs.PicsDir, "pics", "pics", "pictures directory")
|
flag.StringVar(&cliArgs.PicsDir, "pics", "pics", "pictures directory")
|
||||||
|
@ -436,7 +436,7 @@ func UploadImage(c *control.CliArgs) http.HandlerFunc {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
imgMD := fmt.Sprint("![", header.Filename, "](/pics/", filename, ")")
|
imgMD := fmt.Sprint("![", header.Filename, "](", c.Domain, "/pics/", filename, ")")
|
||||||
tmpl, err := template.ParseFiles(c.WebDir + "/templates/editor.html")
|
tmpl, err := template.ParseFiles(c.WebDir + "/templates/editor.html")
|
||||||
template.Must(tmpl, err).ExecuteTemplate(w, "editor-images", imgMD)
|
template.Must(tmpl, err).ExecuteTemplate(w, "editor-images", imgMD)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user