refactor: update app instance structure to include both mailserver and logger

This commit is contained in:
2024-08-18 13:35:07 +07:00
parent 7df02c270b
commit d64a4a587e
23 changed files with 147 additions and 225 deletions

View File

@ -5,6 +5,7 @@ import (
"crypto/sha1"
"encoding/base64"
"fmt"
"github.com/fossyy/filekeeper/app"
mathRand "math/rand"
"net/http"
"os"
@ -13,7 +14,6 @@ import (
"time"
"unicode"
"github.com/fossyy/filekeeper/logger"
"github.com/joho/godotenv"
"golang.org/x/crypto/bcrypt"
)
@ -24,7 +24,6 @@ type Env struct {
}
var env *Env
var log *logger.AggregatedLogger
func init() {
env = &Env{value: map[string]string{}}
@ -110,7 +109,7 @@ func Getenv(key string) string {
if os.Getenv("HOSTNAME") == "" {
err := godotenv.Load(".env")
if err != nil {
log.Error("Error loading .env file: %s", err)
app.Server.Logger.Error("Error loading .env file: %s", err)
}
}