val remoteDatasourceModule = module {
single { createOkHttpClient() }
single { createWebService<ConfigDatasource>(get(), getProperty(DatasourceProperties.SERVER_URL)) }
single { ConfigRepositoryImpl(get()) as ConfigRepository }
}
object DatasourceProperties {
const val SERVER_URL = BuildConfig.BASE_URL
}
This seems to work just fine when I hardcode the SERVER_URL otherwise i get "Can't find property"
t
tapchicoma
10/13/2018, 9:47 AM
How you provided properties? Usually it should be done in
startKoin()
call.
d
dknapp
10/14/2018, 5:17 PM
The loadProperties value now defaults to false so you have to explicitly start it during
startKoin()
. This isn’t in the koin documentation and should probably be added.
r
rezenebe
10/14/2018, 7:59 PM
Thanks @dknapp & @tapchicoma
Copy code
startKoin(this, listOf(appModule, remoteDatasourceModule),
extraProperties = mapOf(SERVER_URL to BuildConfig.BASE_URL))
}