Skip to content

Instantly share code, notes, and snippets.

@Ruhshan
Created December 30, 2020 06:10
Show Gist options
  • Save Ruhshan/8368df38a13bb6e848a2247fb5954886 to your computer and use it in GitHub Desktop.
Save Ruhshan/8368df38a13bb6e848a2247fb5954886 to your computer and use it in GitHub Desktop.
@Configuration
public class FireStoreConfig {
@Bean
public Firestore getFireStore(@Value("${firebase.credential.path}") String credentialPath) throws IOException {
var serviceAccount = new FileInputStream(credentialPath);
var credentials = GoogleCredentials.fromStream(serviceAccount);
var options = FirestoreOptions.newBuilder()
.setCredentials(credentials).build();
return options.getService();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment