generate last-modified string at settings init

This commit is contained in:
0xJacky 2022-03-07 18:56:16 +08:00
parent 77dfd64445
commit c4f7bb7604
4 changed files with 14 additions and 9 deletions

View file

@ -1,14 +1,18 @@
package settings
import (
"github.com/spf13/cast"
"gopkg.in/ini.v1"
"log"
"strings"
"time"
)
var Conf *ini.File
var (
BuildTime string
buildTime string
LastModified string
)
type Server struct {
@ -36,6 +40,11 @@ var sections = map[string]interface{}{
"server": ServerSettings,
}
func init() {
t := time.Unix(cast.ToInt64(buildTime), 0)
LastModified = strings.ReplaceAll(t.Format(time.RFC1123), "UTC", "GMT")
}
func Init(confPath string) {
ConfPath = confPath
Setup()