From 890d5c80f33c0b021cecf08a486fcd62168aaa1c Mon Sep 17 00:00:00 2001 From: Andrew-71 Date: Tue, 23 Apr 2024 23:16:20 +0300 Subject: [PATCH] Use Local as default TZ --- README.md | 2 +- TODO.md | 1 + config.go | 4 ++-- config/config.txt | 2 +- update-docker.sh | 6 ++++++ 5 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 update-docker.sh diff --git a/README.md b/README.md index 6c1d591..d12f3a2 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ they are provided purely for demonstration only and **will break the config if p username=admin # Your username password=admin # Your password port=7101 # What port to run on (probably leave on 7101 if using docker) -timezone=UTC # IANA Time zone database identifier ("UTC", Local", "Europe/Moscow" etc.), Defaults to UTC if can't parse. +timezone=Local # IANA Time zone database identifier ("UTC", Local", "Europe/Moscow" etc.), Defaults to Local if can't parse. log_to_file=false # Whether to write logs to a file (located in /log.txt) enable_scram=false # Whether the app should shut down if there are 3 or more failed login attempts within 100 seconds diff --git a/TODO.md b/TODO.md index f480bf1..b3ddb08 100644 --- a/TODO.md +++ b/TODO.md @@ -11,4 +11,5 @@ List of things to add to this project * Customise log file * More slog.Debug and a debug flag? * Consider less clunky auth method +* Consider localisation * *Go* dependency-less? <-- this is a terrible idea \ No newline at end of file diff --git a/config.go b/config.go index 06484e0..60d0b81 100644 --- a/config.go +++ b/config.go @@ -83,7 +83,7 @@ func (c *Config) Reload() error { } else if key == "timezone" { loc, err := time.LoadLocation(value) if err != nil { - c.Timezone = time.UTC + c.Timezone = time.Local } else { c.Timezone = loc } @@ -114,7 +114,7 @@ func (c *Config) Reload() error { // ConfigInit loads config on startup func ConfigInit() Config { - cfg := Config{Port: 7101, Username: "admin", Password: "admin", Timezone: time.UTC} // Default values are declared here, I guess + cfg := Config{Port: 7101, Username: "admin", Password: "admin", Timezone: time.Local} // Default values are declared here, I guess err := cfg.Reload() if err != nil { log.Fatal(err) diff --git a/config/config.txt b/config/config.txt index c56a9d1..bde8ece 100644 --- a/config/config.txt +++ b/config/config.txt @@ -1,6 +1,6 @@ username=admin password=admin port=7101 -timezone=UTC +timezone=Local log_to_file=false enable_scram=false diff --git a/update-docker.sh b/update-docker.sh new file mode 100644 index 0000000..95fca67 --- /dev/null +++ b/update-docker.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# Script for me to easily update docker package +# ...I really need CI/CD +docker build https://git.a71.su/Andrew71/hibiscus.git -t git.a71.su/andrew71/hibiscus:latest +docker login git.a71.su +docker push git.a71.su/andrew71/hibiscus:latest \ No newline at end of file