aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config-init7
-rw-r--r--config/config.go4
-rw-r--r--main.go6
3 files changed, 11 insertions, 6 deletions
diff --git a/config-init b/config-init
index 99a75f7..ae950b8 100644
--- a/config-init
+++ b/config-init
@@ -26,13 +26,14 @@ emailpass:
## enter proxy ip and port if you want to have tor connections supported
## 127.0.0.1:9050 default
-
torproxy:
## Change to true if you want your instance to be added to the public instance index
-
publicindex:false
## add your instance salt here for secure tripcodes
-
instancesalt:
+
+## this is the key used to access moderation pages leave empty to randomly generate each restart
+## share with other admin or jannies if you are having others to moderate
+modkey:
diff --git a/config/config.go b/config/config.go
index 11f4792..02d43eb 100644
--- a/config/config.go
+++ b/config/config.go
@@ -33,10 +33,12 @@ var PostCountPerPage = 10
var SupportedFiles = []string{"image/gif", "image/jpeg", "image/png", "image/webp", "image/apng", "video/mp4", "video/ogg", "video/webm", "audio/mpeg", "audio/ogg", "audio/wav", "audio/wave", "audio/x-wav"}
var Log = log.New(os.Stdout, "", log.Ltime)
var MediaHashs = make(map[string]string)
-var Key string
+var Key = GetConfigValue("modkey", "")
var Themes []string
var DB *sql.DB
+// TODO Change this to some other config format like YAML
+// to save into a struct and only read once
func GetConfigValue(value string, ifnone string) string {
file, err := os.Open("config/config-init")
diff --git a/main.go b/main.go
index d362244..b570102 100644
--- a/main.go
+++ b/main.go
@@ -143,8 +143,10 @@ func Init() {
config.Log.Println(err)
}
- if config.Key, err = util.CreateKey(32); err != nil {
- config.Log.Println(err)
+ if config.Key == "" {
+ if config.Key, err = util.CreateKey(32); err != nil {
+ config.Log.Println(err)
+ }
}
if err = util.LoadThemes(); err != nil {