This commit is contained in:
parent
520ea1f3ca
commit
be9ad98f58
1 changed files with 12 additions and 2 deletions
10
main.go
10
main.go
|
@ -3,6 +3,7 @@ package main
|
|||
import (
|
||||
"database/sql"
|
||||
"embed"
|
||||
"errors"
|
||||
"github.com/flamego/captcha"
|
||||
"github.com/flamego/cors"
|
||||
"github.com/flamego/flamego"
|
||||
|
@ -94,10 +95,19 @@ func s3Connect() {
|
|||
log.Debug().Msg("Finish create s3 client")
|
||||
}
|
||||
func loadEnvConfig() {
|
||||
if _, err := os.Stat(".env"); err == nil {
|
||||
err := godotenv.Load()
|
||||
if err != nil {
|
||||
log.Fatal().Err(err).Msg("Error loading .env file")
|
||||
}
|
||||
|
||||
} else if errors.Is(err, os.ErrNotExist) {
|
||||
log.Info().Msg("No .env file found")
|
||||
|
||||
} else {
|
||||
log.Fatal().Err(err).Msg("Error load config from env")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
|
Loading…
Reference in a new issue