forked from jason/cpolis
		
	Added title, link and description to cli args.
This commit is contained in:
		
							
								
								
									
										72
									
								
								.air.toml
									
									
									
									
									
								
							
							
						
						
									
										72
									
								
								.air.toml
									
									
									
									
									
								
							@@ -3,42 +3,52 @@ testdata_dir = "testdata"
 | 
			
		||||
tmp_dir = "tmp"
 | 
			
		||||
 | 
			
		||||
[build]
 | 
			
		||||
  args_bin = []
 | 
			
		||||
  bin = "./tmp/main -domain localhost:8080 -key tmp/key.gob -log tmp/cpolis.log -pics tmp/pics -rss tmp/orientexpress_alle.rss -web web"
 | 
			
		||||
  cmd = "go build -o ./tmp/main ./cmd/main.go"
 | 
			
		||||
  delay = 0
 | 
			
		||||
  exclude_dir = ["assets", "tmp", "vendor", "testdata"]
 | 
			
		||||
  exclude_file = []
 | 
			
		||||
  exclude_regex = ["_test.go"]
 | 
			
		||||
  exclude_unchanged = false
 | 
			
		||||
  follow_symlink = false
 | 
			
		||||
  full_bin = ""
 | 
			
		||||
  include_dir = []
 | 
			
		||||
  include_ext = ["go", "tpl", "tmpl", "html", "css"]
 | 
			
		||||
  include_file = []
 | 
			
		||||
  kill_delay = "0s"
 | 
			
		||||
  log = "build-errors.log"
 | 
			
		||||
  poll = false
 | 
			
		||||
  poll_interval = 0
 | 
			
		||||
  rerun = false
 | 
			
		||||
  rerun_delay = 500
 | 
			
		||||
  send_interrupt = false
 | 
			
		||||
  stop_on_error = false
 | 
			
		||||
args_bin = [
 | 
			
		||||
    "-desc 'Freiheit, Gleichheit, Brüderlichkeit, Toleranz und Humanität'",
 | 
			
		||||
    "-domain localhost:8080",
 | 
			
		||||
    "-key tmp/key.gob",
 | 
			
		||||
    "-link https://distrikt-ni-st.de",
 | 
			
		||||
    "-log tmp/cpolis.log",
 | 
			
		||||
    "-pics tmp/pics",
 | 
			
		||||
    "-rss tmp/orientexpress_alle.rss",
 | 
			
		||||
    "-title 'Freimaurer Distrikt Niedersachsen und Sachsen-Anhalt'",
 | 
			
		||||
    "-web web"
 | 
			
		||||
]
 | 
			
		||||
bin = "./tmp/main"
 | 
			
		||||
cmd = "go build -o ./tmp/main ./cmd/main.go"
 | 
			
		||||
delay = 0
 | 
			
		||||
exclude_dir = ["assets", "tmp", "vendor", "testdata"]
 | 
			
		||||
exclude_file = []
 | 
			
		||||
exclude_regex = ["_test.go"]
 | 
			
		||||
exclude_unchanged = false
 | 
			
		||||
follow_symlink = false
 | 
			
		||||
full_bin = ""
 | 
			
		||||
include_dir = []
 | 
			
		||||
include_ext = ["go", "tpl", "tmpl", "html", "css"]
 | 
			
		||||
include_file = []
 | 
			
		||||
kill_delay = "0s"
 | 
			
		||||
log = "build-errors.log"
 | 
			
		||||
poll = false
 | 
			
		||||
poll_interval = 0
 | 
			
		||||
rerun = false
 | 
			
		||||
rerun_delay = 500
 | 
			
		||||
send_interrupt = false
 | 
			
		||||
stop_on_error = false
 | 
			
		||||
 | 
			
		||||
[color]
 | 
			
		||||
  app = ""
 | 
			
		||||
  build = "yellow"
 | 
			
		||||
  main = "magenta"
 | 
			
		||||
  runner = "green"
 | 
			
		||||
  watcher = "cyan"
 | 
			
		||||
app = ""
 | 
			
		||||
build = "yellow"
 | 
			
		||||
main = "magenta"
 | 
			
		||||
runner = "green"
 | 
			
		||||
watcher = "cyan"
 | 
			
		||||
 | 
			
		||||
[log]
 | 
			
		||||
  main_only = false
 | 
			
		||||
  time = false
 | 
			
		||||
main_only = false
 | 
			
		||||
time = false
 | 
			
		||||
 | 
			
		||||
[misc]
 | 
			
		||||
  clean_on_exit = false
 | 
			
		||||
clean_on_exit = false
 | 
			
		||||
 | 
			
		||||
[screen]
 | 
			
		||||
  clear_on_rebuild = false
 | 
			
		||||
  keep_scroll = true
 | 
			
		||||
clear_on_rebuild = false
 | 
			
		||||
keep_scroll = true
 | 
			
		||||
 
 | 
			
		||||
@@ -7,14 +7,17 @@ import (
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type CliArgs struct {
 | 
			
		||||
	DBName  string
 | 
			
		||||
	Domain  string
 | 
			
		||||
	KeyFile string
 | 
			
		||||
	LogFile string
 | 
			
		||||
	Port    string
 | 
			
		||||
	PicsDir string
 | 
			
		||||
	RSSFile string
 | 
			
		||||
	WebDir  string
 | 
			
		||||
	Description string
 | 
			
		||||
	DBName      string
 | 
			
		||||
	Domain      string
 | 
			
		||||
	KeyFile     string
 | 
			
		||||
	Link        string
 | 
			
		||||
	LogFile     string
 | 
			
		||||
	Port        string
 | 
			
		||||
	PicsDir     string
 | 
			
		||||
	RSSFile     string
 | 
			
		||||
	Title       string
 | 
			
		||||
	WebDir      string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func HandleCliArgs() (*CliArgs, error) {
 | 
			
		||||
@@ -22,12 +25,15 @@ func HandleCliArgs() (*CliArgs, error) {
 | 
			
		||||
	cliArgs := new(CliArgs)
 | 
			
		||||
 | 
			
		||||
	flag.StringVar(&cliArgs.DBName, "db", "cpolis", "DB name")
 | 
			
		||||
	flag.StringVar(&cliArgs.Description, "desc", "Description", "Channel description")
 | 
			
		||||
	flag.StringVar(&cliArgs.Domain, "domain", "", "domain name")
 | 
			
		||||
	keyFile := flag.String("key", "/var/www/cpolis/cpolis.key", "key file")
 | 
			
		||||
	flag.StringVar(&cliArgs.Link, "link", "Link", "Channel Link")
 | 
			
		||||
	logFile := flag.String("log", "/var/log/cpolis.log", "log file")
 | 
			
		||||
	flag.StringVar(&cliArgs.PicsDir, "pics", "pics", "pictures directory")
 | 
			
		||||
	port := flag.Int("port", 8080, "port")
 | 
			
		||||
	rssFile := flag.String("rss", "/var/www/cpolis/cpolis.rss", "RSS file")
 | 
			
		||||
	flag.StringVar(&cliArgs.Title, "title", "Title", "Channel title")
 | 
			
		||||
	webDir := flag.String("web", "/var/www/cpolis/web", "web directory")
 | 
			
		||||
	flag.Parse()
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -338,12 +338,7 @@ func PublishArticle(c *control.CliArgs, db *model.DB, s *control.CookieStore) ht
 | 
			
		||||
			return
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		feed, err := control.GenerateRSS(
 | 
			
		||||
			db,
 | 
			
		||||
			"Freimaurer Distrikt Niedersachsen und Sachsen-Anhalt",
 | 
			
		||||
			"https://distrikt-ni-st.de",
 | 
			
		||||
			"Freiheit, Gleichheit, Brüderlichkeit, Toleranz und Humanität",
 | 
			
		||||
		)
 | 
			
		||||
		feed, err := control.GenerateRSS(db, c.ChanTitle, c.ChanLink, c.ChanDescription)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			log.Println(err)
 | 
			
		||||
			http.Error(w, err.Error(), http.StatusInternalServerError)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user