diff --git a/cmd/control/cli.go b/cmd/control/cli.go index 1715d66..0b870b3 100644 --- a/cmd/control/cli.go +++ b/cmd/control/cli.go @@ -8,6 +8,7 @@ import ( type CliArgs struct { DBName string + Domain string KeyFile string LogFile string Port string @@ -21,6 +22,7 @@ func HandleCliArgs() (*CliArgs, error) { cliArgs := new(CliArgs) 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") logFile := flag.String("log", "/var/log/cpolis.log", "log file") flag.StringVar(&cliArgs.PicsDir, "pics", "pics", "pictures directory") diff --git a/cmd/view/articles.go b/cmd/view/articles.go index 14b18e7..490390c 100644 --- a/cmd/view/articles.go +++ b/cmd/view/articles.go @@ -436,7 +436,7 @@ func UploadImage(c *control.CliArgs) http.HandlerFunc { 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") template.Must(tmpl, err).ExecuteTemplate(w, "editor-images", imgMD) }