Skip to content

Commit

Permalink
prep pt2
Browse files Browse the repository at this point in the history
  • Loading branch information
APandamonium1 committed Aug 11, 2024
1 parent 2e473ee commit 3722257
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
17 changes: 9 additions & 8 deletions database.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"log"
"net/http"
"os"
"strings"

firebase "firebase.google.com/go"
Expand All @@ -16,16 +17,16 @@ import (
var firebaseClient *db.Client

func SessionCookie() (string, error) {
sessionCookieStore := goDotEnvVariable("SESSION_COOKIE_STORE")
if sessionCookieStore == "" {
return sessionCookieStore, fmt.Errorf("SESSION_COOKIE_STORE is not set in the environment variables")
}

// sessionCookieStore, found := os.LookupEnv("COOKIESTORE")
// if !found {
// log.Fatalf("COOKIESTORE is not set in the environment variables")
// sessionCookieStore := goDotEnvVariable("SESSION_COOKIE_STORE")
// if sessionCookieStore == "" {
// return sessionCookieStore, fmt.Errorf("SESSION_COOKIE_STORE is not set in the environment variables")
// }

sessionCookieStore, found := os.LookupEnv("COOKIESTORE")
if !found {
log.Fatalf("COOKIESTORE is not set in the environment variables")
}

return sessionCookieStore, nil
}

Expand Down
20 changes: 10 additions & 10 deletions firebase.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ func goDotEnvVariable(key string) string {
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 3722257

Please sign in to comment.