feat: add .env
This commit is contained in:
parent
f338d86663
commit
cb61a2a8b7
2 changed files with 10 additions and 0 deletions
2
.env.example
Normal file
2
.env.example
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
# Port for the server
|
||||
PORT=8888
|
||||
|
|
@ -4,10 +4,18 @@ import (
|
|||
"log/slog"
|
||||
"os"
|
||||
|
||||
"github.com/joho/godotenv"
|
||||
"github.com/lmittmann/tint"
|
||||
)
|
||||
|
||||
func main() {
|
||||
logger := slog.New(tint.NewHandler(os.Stderr, nil))
|
||||
slog.SetDefault(logger)
|
||||
|
||||
err := godotenv.Load()
|
||||
if err != nil {
|
||||
slog.Error("Error loading .env file", slog.Any("error", err))
|
||||
}
|
||||
|
||||
slog.Info("Starting server", slog.Any("port", os.Getenv("PORT")))
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue