aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulio Capote <jcapote@gmail.com>2023-01-08 17:35:53 +0000
committerJulio Capote <jcapote@gmail.com>2023-01-08 17:35:53 +0000
commit0e263eca4109afa2a326e1647d451f6ecbf4aba2 (patch)
tree3234e59153d9579124d7edcf8da4a589554bb224
parent7fc4591459dd36a34c0c8b55f5efd0e47de39c73 (diff)
downloadcommunique-0e263eca4109afa2a326e1647d451f6ecbf4aba2.tar.gz
use a flag for config file
Diffstat (limited to '')
-rw-r--r--TODO1
-rw-r--r--main.go9
-rw-r--r--sample-config.toml8
3 files changed, 13 insertions, 5 deletions
diff --git a/TODO b/TODO
index 295af31..f065409 100644
--- a/TODO
+++ b/TODO
@@ -2,5 +2,4 @@
* attachment support
* namespace everything to /c/ so apache can 404 requests to / instead of us
* makes webserver config harder due to .well-known needing to live at the root
-* outbox return latest 20 posts only
* support -1 dedupInterval
diff --git a/main.go b/main.go
index d7ab887..d46e53e 100644
--- a/main.go
+++ b/main.go
@@ -1,6 +1,7 @@
package main
import (
+ "flag"
"sync"
"time"
@@ -26,9 +27,11 @@ func main() {
// Config
var cfg config.Config
- //TODO use a flag here
- //TODO ensure that handler names only contain AZa-z and '-'
- _, err := toml.DecodeFile("sample-config.toml", &cfg)
+ var cFlag = flag.String("c", "sample-config.toml", "path to config file")
+
+ flag.Parse()
+
+ _, err := toml.DecodeFile(*cFlag, &cfg)
if err != nil {
log.Fatal(err)
}
diff --git a/sample-config.toml b/sample-config.toml
index 360e902..f81e9ed 100644
--- a/sample-config.toml
+++ b/sample-config.toml
@@ -20,7 +20,8 @@ interval = "5s" # required
summary = "sample bot" # optional
# deduplication window, 0 by default, which is NO deduplication
dedupWindow = "30s" # optional
-# avatar url
+# url to the avatar
+# this is downloaded/updated every time the server is restarted
avatarUrl = "https://loremflickr.com/320/240/dog" # optional
# expected content type of avatar url
avatarContentType = "image/jpeg" # required (if using avatarUrl)
@@ -29,3 +30,8 @@ avatarContentType = "image/jpeg" # required (if using avatarUr
# name = "another"
# exec = "another-cgi-handler.sh"
# interval = "10"
+
+# [[handlers]]
+# name = "yetAnother"
+# exec = "yet-another-cgi-handler.sh"
+# interval = "10" \ No newline at end of file