Skip to content

Commit

Permalink
renaming of handler file + env file example + utility for env file re…
Browse files Browse the repository at this point in the history
…ading
  • Loading branch information
RabbITCybErSeC committed Jun 18, 2024
1 parent 4cbf153 commit ead10cc
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SOARCA_URI: http://localhost:8080
GIN_MODE: "release"
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions handlers/status.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package handlers

import "github.com/gin-gonic/gin"

type StatusHandler struct{}

func (s *StatusHandler) StatusIndicator(context *gin.Context) {
}
9 changes: 9 additions & 0 deletions server/main.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package main

import (
"fmt"

"soarca-gui/routes"

"github.com/gin-gonic/gin"
"github.com/joho/godotenv"
)

var (
Expand All @@ -12,6 +15,12 @@ var (
)

func main() {
errenv := godotenv.Load(".env")

if errenv != nil {
fmt.Println("Failed to read env variable, but will continue")
}

app := gin.Default()
routes.Setup(app)

Expand Down
10 changes: 10 additions & 0 deletions utils/env_reader.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package utils

import "os"

func GetEnv(key, fallback string) string {
if value, ok := os.LookupEnv(key); ok {
return value
}
return fallback
}

0 comments on commit ead10cc

Please sign in to comment.