commit 39d0c2c5d275aed6f36cbb209a99160b8236a093
parent 39cd2184c54d76f5a5132c3638ffe0c35dc85375
Author: Alexander Cobleigh <cblgh@cblgh.org>
Date: Mon, 22 Jul 2024 11:59:56 +0200
Merge pull request #68 from decentral1se/easier-run-dev
refactor: only require --dev for local hackin'
Diffstat:
2 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/README.md b/README.md
@@ -76,8 +76,7 @@ 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)