Firetor is Ktor plugin to help you simplified connecting to firebase admin
Firetor was distributed through jitpack and this sample is using gradle.kts file.
Configured this code in build.gradle.kts
repositories {
...
maven("https://jitpack.io")
}
dependencies {
...
implementation("com.github.KylixEza:firetor:$firetor_version")
}
firetor_version
depends on released tag, you can check released tag in jitpack banner above.
This is some steps to configure Firetor:
- Go to your firebase console
- Create new project
- Go to project dashboard and choose
Project Settings
- Choose
Service accounts
tab and click buttonGenerate new private key
- Save admin key into proper folder
- Moved that admin key to
resource
folder in your Ktor Project - Create new Kotlin file in
plugins
package namedFiretor
Firetor.kt
fun Application.configureFiretor() {
install(Firetor) {
setAdminKey("your-admin-key-file-name.json")
setBasicConfiguration {
//Setup other Firebase Options configuration manually
}
}
}
Function | Parameters | Parameter Type | Example | Mandatory |
---|---|---|---|---|
setAdminKey() |
fileName | String | "firetor-sample-admin-key.json" |
Yes |
enableFirebaseStorage() |
bucketUrl | String | "firetor-sample.appspot.com" |
No |
setBasicConfiguration() |
config | FirbaseOptions.Builder.() -> FirebaseOptions.Builder? | this.setConnectTimeout(10000).setDatabaseUrl("https://firetor.firebaseio.com").setReadTimeout(10000) |
No |
Application.kt
fun main() {
...
}
fun Application.module() {
...
configureFiretor()
}
Firetor still has access to configure other firebase options such as setDatabaseUrl, setThreadManager, setGoogleCredendtials, etc. But you need to setup that manually through
setBasicConfiguration()
function and you can write your own code as stated in firebase's documentation
Please fork this repository and contribute back using pull request.
Any contributions, large or small, major features, bug fixes, are welcomed and appreciated but will be thoroughly reviewed .
Don't forget to ⭐ this repository to motivates me to share more open source library