34 lines
529 B
Go
34 lines
529 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"log"
|
||
|
"net/http"
|
||
|
"os"
|
||
|
|
||
|
"wrapped-shell/internal/web"
|
||
|
|
||
|
"github.com/joho/godotenv"
|
||
|
)
|
||
|
|
||
|
func main() {
|
||
|
// Load .env file
|
||
|
err := godotenv.Load()
|
||
|
if err != nil {
|
||
|
log.Fatal("Error loading .env file")
|
||
|
}
|
||
|
|
||
|
// Server config
|
||
|
port := os.Getenv("SERVER_PORT")
|
||
|
if port == "" {
|
||
|
port = "8080"
|
||
|
}
|
||
|
|
||
|
// Start server
|
||
|
http.HandleFunc("/", web.Routes)
|
||
|
log.Printf("Server running on port %s...", port)
|
||
|
err = http.ListenAndServe(":"+port, nil)
|
||
|
if err != nil {
|
||
|
log.Fatalf("Error starting server: %s", err)
|
||
|
}
|
||
|
}
|