fixing issue with firebase on deploy
This commit is contained in:
@@ -4,20 +4,25 @@ import com.google.auth.oauth2.GoogleCredentials;
|
||||
import com.google.firebase.FirebaseApp;
|
||||
import com.google.firebase.FirebaseOptions;
|
||||
import com.google.firebase.messaging.FirebaseMessaging;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
@Configuration
|
||||
public class FirebaseConfig {
|
||||
|
||||
@Value("${firebase.credentials.path}")
|
||||
private String credentialsPath;
|
||||
|
||||
@Bean
|
||||
public FirebaseApp firebaseApp() throws IOException {
|
||||
GoogleCredentials credentials = GoogleCredentials
|
||||
.fromStream(new ClassPathResource("firebase.json").getInputStream())
|
||||
.fromStream(new FileInputStream(credentialsPath))
|
||||
.createScoped(List.of("https://www.googleapis.com/auth/firebase.messaging"));
|
||||
|
||||
FirebaseOptions options = FirebaseOptions.builder()
|
||||
|
||||
Reference in New Issue
Block a user