cerca

lean forum software (pmc local branch)
Log | Files | Refs | README | LICENSE

commit e2a3f9d6c15c219a9df600239cd3d36777c44249
parent 553edadf17558020086ae9577c675bcbcfc58489
Author: decentral1se <cellarspoon@riseup.net>
Date:   Sun, 21 Jul 2024 22:45:44 +0200

refactor: only require --dev for local hackin'

Diffstat:
MREADME.md | 3+--
Mrun.go | 20+++++++++++++++++---
2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/README.md b/README.md @@ -76,7 +76,6 @@ Install [golang](https://go.dev/). To launch a local instance of the forum, run those commands (linux): -- `touch temp.txt` -- `go run run.go --authkey 0 --allowlist temp.txt --dev` +- `go run run.go --dev` It should respond `Serving forum on :8277`. Just go on [http://localhost:8277](http://localhost:8277). diff --git a/run.go b/run.go @@ -46,9 +46,23 @@ func main() { flag.StringVar(&dataDir, "data", "./data", "directory where cerca will dump its database") flag.Parse() if len(sessionKey) == 0 { - complain("please pass a random session auth key with --authkey") - } else if len(allowlistLocation) == 0 { - complain("please pass a file containing the verification code domain allowlist") + if !dev { + complain("please pass a random session auth key with --authkey") + } + sessionKey = "0" + } + if len(allowlistLocation) == 0 { + if !dev { + complain("please pass a file containing the verification code domain allowlist") + } + allowlistLocation = "temp-allowlist.txt" + created, err := util.CreateIfNotExist(allowlistLocation, "") + if err != nil { + complain(fmt.Sprintf("couldn't create %s: %s", allowlistLocation, err)) + } + if created { + fmt.Println(fmt.Sprintf("Created %s", allowlistLocation)) + } } err := os.MkdirAll(dataDir, 0750)