jooby-project / jooby

The modular web framework for Java and Kotlin
https://jooby.io
Apache License 2.0
1.71k stars 197 forks source link

jdbc settings programmatically #429

Closed sergix44 closed 8 years ago

sergix44 commented 8 years ago

About the jdbc module http://jooby.org/doc/jdbc/ it's possible to setup the database configuration (connection string, database user, database password, etc) programmatically without setting in application.conf? (picked up from other config file or from user input)

jknack commented 8 years ago

not now, but was thinking on this today.. bc new/recent db modules supports url programmatically:

{
   use(new Cassandra("cassandra://localhost/db"));
}

will add this for next release.

BUT! configuration is very powerful, you can use your own .conf file, not need to use application.conf

  use(ConfigFactory.parseResources("mydb.conf"));

I just created #428 which is just syntax sugar for this line.

Also, you can specify db property from command line or environment

java -jar myapp.jar db.url=... db.user=... db.password=...

args/environment variables take precedence over properties from .conf file

let me know if you have questions

thanks

ilVecc commented 8 years ago

Thanks for the suggestions. I was wondering, when you will add this freaking awesome new features to this beautiful framework?

jknack commented 8 years ago

@FreVecc which feature?

Guys, do you like jooby?

Please star/follow us on jooby-project and @joobyproject!!!

ilVecc commented 8 years ago

I meant the new Cassandra(...) feature