package main import ( "github.com/gin-gonic/gin" "os" "log/slog" ) // Grab some required spotify credentials from the environment var spotifyClientID = os.Getenv("SPOTIFY_ID") var spotifyClientSecret = os.Getenv("SPOTIFY_SECRET") // DB related setup var db = make(map[string]string) func main() { // If the auth/ID variables are empty something is probably misconfigured if spotifyClientID == "" { slog.Warn("[GOMUSIC] No Spotify ID configured in 'SPOTIFY_ID' environment variable") } if spotifyClientSecret == "" { slog.Warn("[GOMUSIC] No Spotify secret configured in 'SPOTIFY_SECRET' environment variable") } // API server setup var r *gin.Engine = gin.Default() // Add middleware to handle spotify auth for us r.Use(spotifyAuth(spotifyClientID, spotifyClientSecret)) r.GET("/ping", ping) r.GET("/artists/:artistID", getArtistByID) r.Run(":8080") }