initial commit

This commit is contained in:
2023-08-25 22:44:44 +02:00
commit 9848740dbf
12 changed files with 951 additions and 0 deletions

29
cmd/morningalarm.go Normal file
View File

@@ -0,0 +1,29 @@
package main
import (
morningalarm "git.kapelle.org/niklas/morning-alarm/internal"
"github.com/alexflint/go-arg"
)
type args struct {
SpotifyClientID string `arg:"--spotify-client-id,required,env:SPOTIFY_CLIENT_ID" placeholder:"SPOTIFY_CLIENT_ID"`
SpotifyClientSecret string `arg:"--spotify-client-secret,required,env:SPOTIFY_CLIENT_SECRET" placeholder:"SPOTIFY_CLIENT_SECRET"`
DeviceID string `arg:"--device-id,required,env:SPOTIFY_DEVICE_ID" placeholder:"SPOTIFY_DEVICE_ID" help:"Can be found later in the API"`
PlaylistID string `arg:"--playlist-id,required,env:SPOTIFY_PLAYLIST_ID" help:"Just the id" placeholder:"SPOTIFY_PLAYLIST_ID"`
RedirectURL string `arg:"--redirect-url,required,env:SPOTIFY_REDIRECT_URL" help:"Must be the same as in the Spotify developer dashboard." placeholder:"SPOTIFY_REDIRECT_URL"`
ListenAddr string `arg:"--listen-addr,required,env:LISTEN_ADDR" help:"Address to listen on" placeholder:"LISTEN_ADDR" default:":3000"`
}
func main() {
var args args
arg.MustParse(&args)
morningalarm.New(morningalarm.MorningAlarmConfig{
SpotifyClientID: args.SpotifyClientID,
SpotifyClientSecret: args.SpotifyClientSecret,
DeviceID: args.DeviceID,
PlaylistID: args.PlaylistID,
RedirectURL: args.RedirectURL,
ListenAddr: args.ListenAddr,
}).Start()
}