feat(cli): main arguments
This commit is contained in:
parent
b637ff02f6
commit
a50d678a67
1 changed files with 23 additions and 2 deletions
25
main.go
25
main.go
|
@ -2,20 +2,41 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"embed"
|
"embed"
|
||||||
|
"flag"
|
||||||
"github.com/anhgelus/golatt"
|
"github.com/anhgelus/golatt"
|
||||||
|
"log/slog"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:embed templates
|
//go:embed templates
|
||||||
var templates embed.FS
|
var templates embed.FS
|
||||||
|
|
||||||
|
var (
|
||||||
|
domain string
|
||||||
|
data string
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
flag.StringVar(&domain, "domain", "", "domain to use")
|
||||||
|
flag.StringVar(&data, "data", "", "data to use")
|
||||||
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
flag.Parse()
|
||||||
|
if domain == "" {
|
||||||
|
slog.Error("Domain not set. Set it with --domain value")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if data == "" {
|
||||||
|
slog.Error("Data not set. Set it with --data relative path")
|
||||||
|
return
|
||||||
|
}
|
||||||
g := golatt.New(templates)
|
g := golatt.New(templates)
|
||||||
g.DefaultSeoData = &golatt.SeoData{
|
g.DefaultSeoData = &golatt.SeoData{
|
||||||
Image: "",
|
Image: "",
|
||||||
Description: "",
|
Description: "",
|
||||||
Domain: "now.anhgelus.world",
|
Domain: domain,
|
||||||
}
|
}
|
||||||
g.Templates = append(g.Templates, "templates/page/*.gohtml")
|
g.Templates = append(g.Templates, "templates/page/*.gohtml")
|
||||||
|
|
||||||
g.StartServer(":80")
|
//g.StartServer(":80")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue