-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
128 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,4 +20,6 @@ | |
# Go workspace file | ||
go.work | ||
|
||
tmp.go | ||
tmp.go | ||
|
||
config.yaml |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
cammie: | ||
blocked_names: [] | ||
blocked_ips: [] | ||
max_message_length: | ||
spotify: | ||
client_id: | ||
client_secret: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package config | ||
|
||
import ( | ||
"log" | ||
"os" | ||
"sync" | ||
|
||
"gopkg.in/yaml.v3" | ||
) | ||
|
||
type cammieConfig struct { | ||
BlockedNames []string `yaml:"blocked_names"` | ||
BlockedIps []string `yaml:"blocked_ips"` | ||
MaxMessageLength int `yaml:"max_message_length"` | ||
} | ||
|
||
type spotifyConfig struct { | ||
ClientID string `yaml:"client_id"` | ||
ClientSecret string `yaml:"client_secret"` | ||
} | ||
|
||
type Config struct { | ||
Cammie cammieConfig `yaml:"cammie"` | ||
Spotify spotifyConfig `yaml:"spotify"` | ||
} | ||
|
||
var ( | ||
configInstance *Config | ||
once sync.Once | ||
) | ||
|
||
func GetConfig() *Config { | ||
once.Do(func() { | ||
configInstance = &Config{} | ||
data, err := os.ReadFile("config.yaml") | ||
if err != nil { | ||
log.Fatalf("Failed to read config file: %v", err) | ||
} | ||
if err := yaml.Unmarshal(data, configInstance); err != nil { | ||
log.Fatalf("Failed to unmarshal config: %v", err) | ||
} | ||
}) | ||
return configInstance | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package screen | ||
|
||
import "github.com/rivo/tview" | ||
|
||
type Tap struct { | ||
ScreenApp *ScreenApp | ||
view *tview.Box | ||
} | ||
|
||
func NewTap(screenApp *ScreenApp) *Tap { | ||
tap := Tap{ | ||
ScreenApp: screenApp, | ||
view: tview.NewBox().SetBorder(true).SetTitle(" Tap "), | ||
} | ||
|
||
return &tap | ||
} | ||
|
||
func (tap *Tap) Run() { | ||
} | ||
|
||
func (tap *Tap) Update(text string) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters