feat: load optional .env file and add .env.example
This commit is contained in:
committed by
LinkinStars
parent
5ff6106d37
commit
1fbb802e8f
@@ -31,12 +31,18 @@ import (
|
||||
"github.com/apache/answer/internal/base/path"
|
||||
"github.com/apache/answer/internal/schema"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/joho/godotenv"
|
||||
"github.com/segmentfault/pacman"
|
||||
"github.com/segmentfault/pacman/contrib/log/zap"
|
||||
"github.com/segmentfault/pacman/contrib/server/http"
|
||||
"github.com/segmentfault/pacman/log"
|
||||
)
|
||||
|
||||
func init() {
|
||||
// Load .env if present, ignore error to keep backward compatibility
|
||||
_ = godotenv.Load()
|
||||
}
|
||||
|
||||
// go build -ldflags "-X github.com/apache/answer/cmd.Version=x.y.z"
|
||||
var (
|
||||
// Name is the name of the project
|
||||
|
||||
Reference in New Issue
Block a user