41 lines
677 B
Go
41 lines
677 B
Go
package global
|
|
|
|
import (
|
|
"os"
|
|
|
|
"arimelody.me/arimelody.me/music/model"
|
|
"github.com/jmoiron/sqlx"
|
|
)
|
|
|
|
var HTTP_DOMAIN = func() string {
|
|
envvar := os.Getenv("HTTP_DOMAIN")
|
|
if envvar != "" {
|
|
return envvar
|
|
}
|
|
return "https://arimelody.me"
|
|
}
|
|
|
|
var DB *sqlx.DB
|
|
|
|
var Releases []*model.Release
|
|
var Artists []*model.Artist
|
|
var Tracks []*model.Track
|
|
|
|
func GetRelease(id string) *model.Release {
|
|
for _, release := range Releases {
|
|
if release.ID == id {
|
|
return release
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func GetArtist(id string) *model.Artist {
|
|
for _, artist := range Artists {
|
|
if artist.ID == id {
|
|
return artist
|
|
}
|
|
}
|
|
return nil
|
|
}
|