Last active
March 29, 2020 06:11
-
-
Save dllewellyn/ea424d82b10acbd546ecb9f6d7b89e5f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object FirebaseUtil { | |
private val loader: ResourceLoader = ResourceResolver().getLoader(ClassPathResourceLoader::class.java).get(); | |
private var initialised: Boolean = false | |
private val options: FirebaseOptions? = FirebaseOptions.Builder() | |
.setCredentials( | |
GoogleCredentials.fromStream( | |
loader.getResourceAsStream("static/firebase-admin.json") | |
.get() | |
) | |
) | |
.build() | |
fun initialise() { | |
if (initialised.not()) { | |
FirebaseApp.initializeApp(options) | |
initialised = true | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment