feat: extend equipment and workout models with service tracking
This commit is contained in:
46
internal/config/oauth.go
Normal file
46
internal/config/oauth.go
Normal file
@@ -0,0 +1,46 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
)
|
||||
|
||||
type OAuthProviderConfig struct {
|
||||
ClientID string
|
||||
ClientSecret string
|
||||
RedirectURI string
|
||||
AuthURL string
|
||||
TokenURL string
|
||||
}
|
||||
|
||||
type OAuthConfig struct {
|
||||
EncryptionKey string
|
||||
AppURL string
|
||||
Garmin OAuthProviderConfig
|
||||
Wahoo OAuthProviderConfig
|
||||
}
|
||||
|
||||
var OAuth *OAuthConfig
|
||||
|
||||
func InitOAuth() {
|
||||
OAuth = &OAuthConfig{
|
||||
EncryptionKey: os.Getenv("OAUTH_ENCRYPTION_KEY"),
|
||||
AppURL: os.Getenv("APP_URL"),
|
||||
Garmin: OAuthProviderConfig{
|
||||
ClientID: os.Getenv("GARMIN_CLIENT_ID"),
|
||||
ClientSecret: os.Getenv("GARMIN_CLIENT_SECRET"),
|
||||
RedirectURI: os.Getenv("GARMIN_REDIRECT_URI"),
|
||||
AuthURL: "https://apis.garmin.com/tools/oauth2/authorizeUser",
|
||||
TokenURL: "https://diauth.garmin.com/di-oauth2-service/oauth/token",
|
||||
},
|
||||
Wahoo: OAuthProviderConfig{
|
||||
ClientID: os.Getenv("WAHOO_CLIENT_ID"),
|
||||
ClientSecret: os.Getenv("WAHOO_CLIENT_SECRET"),
|
||||
RedirectURI: os.Getenv("WAHOO_REDIRECT_URI"),
|
||||
AuthURL: "https://api.wahooligan.com/oauth/authorize",
|
||||
TokenURL: "https://api.wahooligan.com/oauth/token",
|
||||
},
|
||||
}
|
||||
|
||||
log.Println("OAuth config initialized")
|
||||
}
|
||||
Reference in New Issue
Block a user