I'm using a connected Docker mysql instance with my docker container which contains a Karaf 4 instance configured with a Pax JDBC datasource.
My problem is that my jdbc url depends on some environement variables setup by docker (as the mysql container IP is not always the same). The IP address variable is MYSQL_PORT_3306_TCP_ADDR
.
I tried to start karaf with -DMYSQL_PORT_3306_TCP_ADDR=XXX.XXX.XXX.XXX
and to setup my datasource with a config file (etc/org.ops4j.datasource.mydb.cfg) which would contains:
url=jdbc:mysql://${mysql.port.3306.tcp.addr}:3306/mydb
but looking at the service:list in karaf I see:
url = jdbc:mysql://:3306/pandoradb
so the variable is clearly not used.
Is there an way to do what I want ?
Best.
I finally found the solution!
I don't know why I tried to use the
${mysql.port.3306.tcp.addr}
variable in my conf.... using the correct variable is properly interpreted:Best.