Skip to content

Commit

Permalink
PLEASE SUCCESSFUL
Browse files Browse the repository at this point in the history
  • Loading branch information
PeanutBrrutter committed Jul 15, 2024
1 parent 02603e3 commit f98c9a9
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions firebase.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,41 @@ import (
"log"
"os"

"github.com/joho/godotenv"
//"github.com/joho/godotenv"

firebase "firebase.google.com/go"
"google.golang.org/api/option"
)

// Use godot package to load/read the .env file and
// return the value of the key (for local env)
func goDotEnvVariable(key string) string {
// func goDotEnvVariable(key string) string {

// load .env file
err := godotenv.Load(".env")
// // load .env file
// err := godotenv.Load(".env")

if err != nil {
log.Fatalf("Error loading .env file")
}
// if err != nil {
// log.Fatalf("Error loading .env file")
// }

return os.Getenv(key)
}
// return os.Getenv(key)
// }

// InitializeFirebase initializes the Firebase app and sets the global firebaseClient variable
func initializeFirebase() error {
ctx := context.Background()

// databaseURL, found := os.LookupEnv("DATABASE_URL")
// if !found {
// log.Fatalf("DATABASE_URL is not set in the environment variables")
// }
// opt := option.WithCredentialsFile("edusync-7bd5e-firebase-adminsdk-x49uh-af084a6314.json")

databaseURL := goDotEnvVariable("DATABASE_URL")
if databaseURL == "" {
return fmt.Errorf("DATABASE_URL is not set in the environment variables")
databaseURL, found := os.LookupEnv("DATABASE_URL")
if !found {
log.Fatalf("DATABASE_URL is not set in the environment variables")
}
opt := option.WithCredentialsFile("edusync-test-firebase-adminsdk-hk5kl-9af0162b09.json")
opt := option.WithCredentialsFile("edusync-7bd5e-firebase-adminsdk-x49uh-af084a6314.json")

// databaseURL := goDotEnvVariable("DATABASE_URL")
// if databaseURL == "" {
// return fmt.Errorf("DATABASE_URL is not set in the environment variables")
// }
// opt := option.WithCredentialsFile("edusync-test-firebase-adminsdk-hk5kl-9af0162b09.json")

conf := &firebase.Config{DatabaseURL: databaseURL}

Expand Down

0 comments on commit f98c9a9

Please sign in to comment.