Passport/pkg/services/external_firebase.go
2024-06-06 22:48:43 +08:00

23 lines
401 B
Go

package services
import (
"context"
firebase "firebase.google.com/go"
"github.com/spf13/viper"
"google.golang.org/api/option"
)
var ExtFire *firebase.App
func SetupFirebase() error {
opt := option.WithCredentialsFile(viper.GetString("firebase_credentials"))
app, err := firebase.NewApp(context.Background(), nil, opt)
if err != nil {
return err
} else {
ExtFire = app
}
return nil
}