Skip to content

Commit

Permalink
add port to config (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
JunNishimura committed Sep 1, 2023
1 parent 7e8befc commit 67bab30
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const (
SpotifySecretKey ConfKey = "spotify_secret"
OpenAIAPIKey ConfKey = "openai_api_key"
DeviceID ConfKey = "device_id"
PortKey ConfKey = "port"
AccessTokenKey ConfKey = "access_token"
RefreshTokenKey ConfKey = "refresh_token"
ExpirationKey ConfKey = "expiration"
Expand All @@ -37,7 +38,7 @@ func (k ConfKey) isTokenKey() bool {
}

func (k ConfKey) isClientKey() bool {
return k == SpotifyIDKey || k == SpotifySecretKey || k == OpenAIAPIKey || k == DeviceID
return k == SpotifyIDKey || k == SpotifySecretKey || k == OpenAIAPIKey || k == DeviceID || k == PortKey
}

func newConfig() *Config {
Expand Down Expand Up @@ -181,11 +182,13 @@ func (c *Config) IsClientValid() bool {
spotifySecret := c.clientViper.GetString(string(SpotifySecretKey))
openAIApiKey := c.clientViper.GetString(string(OpenAIAPIKey))
deviceID := c.clientViper.GetString(string(DeviceID))
port := c.clientViper.GetString(string(PortKey))

return spotifyID != "" &&
spotifySecret != "" &&
openAIApiKey != "" &&
deviceID != ""
deviceID != "" &&
port != ""
}

func (c *Config) GetClientValue(key ConfKey) string {
Expand Down

0 comments on commit 67bab30

Please sign in to comment.