feat: init commit
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"eden-server/internal/api"
|
||||
"eden-server/internal/database"
|
||||
"eden-server/internal/runtime"
|
||||
"log/slog"
|
||||
"os"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func main() {
|
||||
logger := slog.New(slog.NewJSONHandler(os.Stdout, nil))
|
||||
slog.SetDefault(logger)
|
||||
|
||||
// grab the environment variables from the runtime environment
|
||||
slog.Info("grabbing environment variables")
|
||||
env := runtime.GrabEnvironment()
|
||||
|
||||
// checking directories to ensure its expected environment is ready
|
||||
slog.Info("ensuring operating environment")
|
||||
if err := runtime.EnsureOperation(env.WorkDir); err != nil {
|
||||
slog.Error("failed to ensure the operating environment", "error", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// initiating the database connection for which we safe things
|
||||
slog.Info("kicking off database connection")
|
||||
db, err := database.KickoffDatabase()
|
||||
if err != nil {
|
||||
slog.Error("failed to initiate a database connection")
|
||||
}
|
||||
|
||||
// get ready to kick off the http api
|
||||
slog.Info("kicking off http api, letting gin take over")
|
||||
gin.SetMode(gin.ReleaseMode)
|
||||
api.KickoffApi(env, db)
|
||||
}
|
||||
Reference in New Issue
Block a user