Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@

# Dependency directories (remove the comment below to include it)
# vendor/
.idea/*

config.yml
77 changes: 77 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package cmd

import (
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"os"
)

var (
log = logrus.New()
verbose string

cfgDir = "."
cfgFile = "config.yml"
config = viper.New()

version = `v0.4.0`
asciiArt = ` __ __
____ ____ ______/ /_____ _____/ /__________ ____
/ __ \/ __ '/ ___/ //_/ _ \/ ___/ __/ ___/ __ \/ __ \
/ /_/ / /_/ / / / ,< / __/ / / /_/ / / /_/ / / / /
/ .___/\__,_/_/ /_/|_|\___/_/ \__/_/ \____/_/ /_/
/_/`
)

var (
rootCmd = &cobra.Command{
Use: "event-manager",
Short: "event management software",
Long: `A software written to manage entire streaming events from fragforce`,
PreRun: setVerbose,
}
)

// Execute adds all child commands to the root command and sets flags appropriately.
// This is called by main.main(). It only needs to happen once to the rootCmd.
func Execute() {
err := rootCmd.Execute()
if err != nil {
os.Exit(1)
}
}

func init() {
rootCmd.PersistentFlags().StringVarP(&cfgFile, "file", "f", cfgFile, "config file name (default is 'config.yml'")
rootCmd.PersistentFlags().StringVarP(&cfgDir, "dir", "d", cfgDir, "config directory path (default is '.)")
rootCmd.PersistentFlags().StringVarP(&verbose, "verbosity", "v", logrus.InfoLevel.String(), "Log level (debug, info, warn, error")

log.Info("starting event manager")
// If a config file is found, read it in.
config.AddConfigPath(cfgDir)
config.SetConfigType("yaml")
config.SetConfigName(cfgFile)

err := config.ReadInConfig()
if err != nil {
log.Panic(err)
}

log.Info("Using config file:", config.ConfigFileUsed())
}

func setVerbose(cmd *cobra.Command, args []string) {
switch verbose {
case "debug":
log.SetLevel(logrus.DebugLevel)
case "info":
log.SetLevel(logrus.DebugLevel)
case "warn":
log.SetLevel(logrus.WarnLevel)
case "error":
log.SetLevel(logrus.ErrorLevel)
default:
log.SetLevel(logrus.DebugLevel)
}
}
29 changes: 29 additions & 0 deletions cmd/start.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package cmd

import (
"github.com/fragforce/event-manager/pkg/webserver"
"github.com/spf13/cobra"
)

// startCmd represents the start command
var startCmd = &cobra.Command{
Use: "start",
Short: "Start manager and services",
Long: `Starts the event manager service manager`,
PreRun: setVerbose,
Run: func(cmd *cobra.Command, args []string) {
log.Debug("starting webserver")
webserver.Start(*config)
//log.Debug("starting sub-services")
},
}

func init() {
rootCmd.AddCommand(startCmd)

// Here you will define your flags and configuration settings.

// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// startCmd.PersistentFlags().String("foo", "", "A help for foo")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
- shift_id: "f403fa5d-fe2c-4424-b0e2-8edab1b51858"
type: "manager"
title: "Manager Shift 1"
start: 2022-11-18T13:00:00Z
length: 6

- shift_id: "1660dad7-87e1-4297-a34c-48a807c49d96"
type: "manager"
title: "Manager Shift 2"
start: 2022-11-18T19:00:00Z
length: 6

- shift_id: "30782162-ac84-4fd8-86b7-80a7f20b53fc"
hash: 86737912e2
type: "streamer"
title: "Streamer Shift 1"
start: 2022-11-18T13:00:00Z
length: 2
game: Streamers Choice

- shift_id: "99b2be2e-9c5a-4342-955c-40990ac67de3"
hash: 25c6bdeddd
type: "streamer"
title: "Streamer Shift 2"
start: 2022-11-18T15:00:00Z
length: 2
game: Streamers Choice

- shift_id: "3055097e-5349-4737-9f55-fe494500387c"
hash: 6a16bbf2e3
type: "streamer"
title: "Streamer Shift 3"
start: 2022-11-18T17:00:00Z
length: 2
game: Streamers Choice

- shift_id: "0d6d5329-427c-4245-ab9c-1b072a9759b5"
hash: 525e1f65d0
type: "streamer"
title: "Streamer Shift 4"
start: 2022-11-18T19:00:00Z
length: 3
game: Villainous (Tabletop Simulator)

- shift_id: "09a073d1-a9d4-4603-9f76-21bc68f259f1"
type: "moderator"
title: "Moderator Shift 1"
start: 2022-11-18T13:00:00Z
length: 3

- shift_id: "e3181f6b-1bcb-477f-b886-660a95bd1629"
type: "moderator"
title: "Moderator Shift 2"
start: 2022-11-18T19:00:00Z
length: 6
56 changes: 56 additions & 0 deletions events/team/60ea1699-467b-452c-a4d4-3eb255d3f313/events.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
- event_id: 5b392c09-435d-4ea7-aae8-54f94a2ccaeb
event_hash: add37bea39
event_name: 2022 Fall Superstream
event_start: 2022-11-18T13:00:00Z
event_length: 40
signup_enabled: false
signups:
- type: "streamer"
has_game: true
questions:
- label: "Twitch Username"
placeholder: "MisterFragbot"
type: "text"
required: true

- type: "moderator"
questions:
- label: "Twitch Username"
placeholder: "MisterFragbot"
type: "text"
required: true

- type: "manager"

- event_id: 8363169e-349f-45fd-98d0-afe12e2c0ab4
event_hash: 22ddedb3a9
event_name: 2022 Summer Superstream
event_start: 2022-08-12T12:00:00Z
event_length: 40

- event_id: 5793a68b-1602-4c0b-9836-9f565eda1935
event_hash: c668c3fe4f
event_name: 2023 Spring Superstream
event_start: 2023-04-14T12:00:00Z
event_length: 40
signup_enabled: true
signups:
- type: "streamer"
has_game: true
questions:
- label: "Twitch Username"
placeholder: "MisterFragbot"
type: "text"
required: true
- label: "Be informed when you can sign up for a stream position?"
type: "checkbox"
required: false

- type: "moderator"
questions:
- label: "Twitch Username"
placeholder: "MisterFragbot"
type: "text"
required: true

- type: "manager"
Empty file.
13 changes: 13 additions & 0 deletions events/teams.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
- guild_id: "164136635762606081"
team_id: 60ea1699-467b-452c-a4d4-3eb255d3f313
team_hash: 2e26389ac3
team_name: Fragforce
team_url: https://fragforce.org
owner_hash: be5917086c
- guild_id: "164136635762606081"
team_id: fd584d9d-8836-4b97-981d-15616ef25f7a
team_hash: 652a664362
team_name: Testing Team
team_url: https://fragforce.org
owner_hash: be5917086c
5 changes: 5 additions & 0 deletions events/users.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- user_id: c2e752b3-1b51-48f1-9168-16866d707c37
user_hash: be5917086c
display_name: parkervcp
discord_id: 122906021160026112
60 changes: 60 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
module github.com/fragforce/event-manager

go 1.19

require (
github.com/gin-gonic/gin v1.8.1
github.com/goccy/go-yaml v1.9.6
github.com/parkervcp/discord-oauth2 v0.0.0-20221107213606-dc8497a5205c
github.com/sirupsen/logrus v1.9.0
github.com/spf13/viper v1.15.0
golang.org/x/oauth2 v0.1.0
)

require (
github.com/fatih/color v1.13.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/gin-contrib/sessions v0.0.5 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-playground/locales v0.14.0 // indirect
github.com/go-playground/universal-translator v0.18.0 // indirect
github.com/go-playground/validator/v10 v10.11.1 // indirect
github.com/goccy/go-json v0.9.11 // indirect
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/gorilla/context v1.1.1 // indirect
github.com/gorilla/securecookie v1.1.1 // indirect
github.com/gorilla/sessions v1.2.1 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/leodido/go-urn v1.2.1 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
github.com/ravener/discord-oauth2 v0.0.0-20220615092331-f6a9839c223e // indirect
github.com/spf13/afero v1.9.3 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/cobra v1.7.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
github.com/ugorji/go/codec v1.2.7 // indirect
github.com/zalando/gin-oauth2 v1.5.3 // indirect
golang.org/x/crypto v0.3.0 // indirect
golang.org/x/net v0.4.0 // indirect
golang.org/x/sys v0.3.0 // indirect
golang.org/x/text v0.5.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading