morningalarm/cmd/morningalarm.go

28 lines
1.1 KiB
Go
Raw Permalink Normal View History

2023-08-25 20:44:44 +00:00
package main
import (
morningalarm "git.kapelle.org/niklas/morning-alarm/internal"
"github.com/alexflint/go-arg"
)
type args struct {
DeviceName string `arg:"--device-name,required,env:SPOTIFY_DEVICE_NAME" placeholder:"SPOTIFY_DEVICE_NAME" 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"`
ListenAddr string `arg:"--listen-addr,env:LISTEN_ADDR" help:"Address to listen on" placeholder:"LISTEN_ADDR" default:":3000"`
OAuthProxyURL string `arg:"--oauth-proxy-url,env:OAUTH_PROXY_URL" help:"URL of the oauth proxy" placeholder:"OAUTH_PROXY_URL"`
OAuthProxyAPIKey string `arg:"--oauth-proxy-api-key,env:OAUTH_PROXY_API_KEY" help:"API key for the oauth proxy" placeholder:"OAUTH_PROXY_API_KEY"`
2023-08-25 20:44:44 +00:00
}
func main() {
var args args
arg.MustParse(&args)
morningalarm.New(morningalarm.MorningAlarmConfig{
DeviceName: args.DeviceName,
PlaylistID: args.PlaylistID,
ListenAddr: args.ListenAddr,
OAuthProxyURL: args.OAuthProxyURL,
OAuthProxyAPIKey: args.OAuthProxyAPIKey,
2023-08-25 20:44:44 +00:00
}).Start()
}