Refactor: Complete authentication flow changes

This commit includes the remaining files from the authentication flow refactoring.\nThese changes were part of the initial diff between c00ea67f31 and HEAD,\nand complete the transition to the new SSO and OAuth-based authentication mechanism.
This commit is contained in:
2025-09-18 13:32:33 -07:00
parent 48bf00150b
commit bb07b261bf
6 changed files with 35 additions and 16 deletions

View File

@@ -3,15 +3,20 @@ package credentials
import (
"fmt"
"os"
"path/filepath"
"github.com/joho/godotenv"
)
// LoadEnvCredentials loads credentials from .env file
func LoadEnvCredentials() (email, password, domain string, err error) {
// Determine project root (assuming .env is in the project root)
projectRoot := "/home/sstent/Projects/go-garth"
envPath := filepath.Join(projectRoot, ".env")
// Load .env file
if err := godotenv.Load(); err != nil {
return "", "", "", fmt.Errorf("error loading .env file: %w", err)
if err := godotenv.Load(envPath); err != nil {
return "", "", "", fmt.Errorf("error loading .env file from %s: %w", envPath, err)
}
email = os.Getenv("GARMIN_EMAIL")
@@ -29,4 +34,4 @@ func LoadEnvCredentials() (email, password, domain string, err error) {
}
return email, password, domain, nil
}
}