Fixed bug with specifying port

This commit is contained in:
Jason Streifling 2024-03-30 10:22:51 +01:00
parent a0fe0024f2
commit 68b052625f

View File

@ -23,7 +23,7 @@ func HandleCliArgs() (*CliArgs, error) {
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")
picsDir := flag.String("pics", "/var/www/cpolis/pics", "pictures directory") picsDir := flag.String("pics", "/var/www/cpolis/pics", "pictures directory")
cliArgs.Port = fmt.Sprint(":", flag.Int("port", 8080, "port")) port := flag.Int("port", 8080, "port")
rssFile := flag.String("rss", "/var/www/cpolis/cpolis.rss", "RSS file") rssFile := flag.String("rss", "/var/www/cpolis/cpolis.rss", "RSS file")
webDir := flag.String("web", "/var/www/cpolis/web", "web directory") webDir := flag.String("web", "/var/www/cpolis/web", "web directory")
flag.StringVar(&cliArgs.DBName, "db", "cpolis", "DB name") flag.StringVar(&cliArgs.DBName, "db", "cpolis", "DB name")
@ -44,6 +44,8 @@ func HandleCliArgs() (*CliArgs, error) {
return nil, fmt.Errorf("error finding absolute path for PicsDir: %v", err) return nil, fmt.Errorf("error finding absolute path for PicsDir: %v", err)
} }
cliArgs.Port = fmt.Sprint(":", *port)
cliArgs.RSSFile, err = filepath.Abs(*rssFile) cliArgs.RSSFile, err = filepath.Abs(*rssFile)
if err != nil { if err != nil {
return nil, fmt.Errorf("error finding absolute path for RSSFile: %v", err) return nil, fmt.Errorf("error finding absolute path for RSSFile: %v", err)