diff options
| author | Shulhan <ms@kilabit.info> | 2022-02-19 01:24:23 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2022-02-19 01:24:23 +0700 |
| commit | 8e18795b55336e604887ec39fed13b59d77b3ad9 (patch) | |
| tree | 70f06be6eeffb4cc62107b9d0a97691a40b1bcad /cmd | |
| parent | be19c57b0f15b69232dcad2293d5d07702bf780f (diff) | |
| download | kilabit.info-8e18795b55336e604887ec39fed13b59d77b3ad9.tar.xz | |
all: update module ciigo
This update use the IsDevelopment option instead of using environment
variable DEBUG to serve in local.
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/www-kilabit/main.go | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/cmd/www-kilabit/main.go b/cmd/www-kilabit/main.go index a57b136..5e9a021 100644 --- a/cmd/www-kilabit/main.go +++ b/cmd/www-kilabit/main.go @@ -1,7 +1,9 @@ package main import ( + "flag" "log" + "strings" "git.sr.ht/~shulhan/ciigo" "github.com/shuLhan/share/lib/memfs" @@ -10,14 +12,30 @@ import ( var memfsContent *memfs.MemFS func main() { + var ( + flagEnv string + ) + log.SetFlags(0) + + flag.StringVar(&flagEnv, "env", "", "set the environment to run") + flag.Parse() + + if len(flagEnv) > 0 { + flagEnv = strings.ToLower(flagEnv) + } + serveOpts := &ciigo.ServeOptions{ ConvertOptions: ciigo.ConvertOptions{ Root: "_content", HtmlTemplate: "_content/template.gohtml", }, - Address: "127.0.0.1:7000", Mfs: memfsContent, + Address: "127.0.0.1:7000", + } + + if flagEnv == "dev" { + serveOpts.IsDevelopment = true } err := ciigo.Serve(serveOpts) |
