Use Local as default TZ

This commit is contained in:
Andrew-71 2024-04-23 23:16:20 +03:00
parent 0a391984f3
commit 890d5c80f3
5 changed files with 11 additions and 4 deletions

View file

@ -46,7 +46,7 @@ they are provided purely for demonstration only and **will break the config if p
username=admin # Your username username=admin # Your username
password=admin # Your password password=admin # Your password
port=7101 # What port to run on (probably leave on 7101 if using docker) 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 <config-dir>/log.txt) log_to_file=false # Whether to write logs to a file (located in <config-dir>/log.txt)
enable_scram=false # Whether the app should shut down if there are 3 or more failed login attempts within 100 seconds enable_scram=false # Whether the app should shut down if there are 3 or more failed login attempts within 100 seconds

View file

@ -11,4 +11,5 @@ List of things to add to this project
* Customise log file * Customise log file
* More slog.Debug and a debug flag? * More slog.Debug and a debug flag?
* Consider less clunky auth method * Consider less clunky auth method
* Consider localisation
* *Go* dependency-less? <-- this is a terrible idea * *Go* dependency-less? <-- this is a terrible idea

View file

@ -83,7 +83,7 @@ func (c *Config) Reload() error {
} else if key == "timezone" { } else if key == "timezone" {
loc, err := time.LoadLocation(value) loc, err := time.LoadLocation(value)
if err != nil { if err != nil {
c.Timezone = time.UTC c.Timezone = time.Local
} else { } else {
c.Timezone = loc c.Timezone = loc
} }
@ -114,7 +114,7 @@ func (c *Config) Reload() error {
// ConfigInit loads config on startup // ConfigInit loads config on startup
func ConfigInit() Config { 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() err := cfg.Reload()
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)

View file

@ -1,6 +1,6 @@
username=admin username=admin
password=admin password=admin
port=7101 port=7101
timezone=UTC timezone=Local
log_to_file=false log_to_file=false
enable_scram=false enable_scram=false

6
update-docker.sh Normal file
View file

@ -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