pax jdbc datasource configuration variable

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.

Answers


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:

url=jdbc:mysql://${MYSQL_PORT_3306_TCP_ADDR}:3306/mydb

Best.


Need Your Help

Accessing a Windows driver from Python

python windows driver

How do I interface with a Windows driver from Python (e.g. send an ioctl)?

Accessing filenames of a multiple file upload form

jquery file-upload input

I want to read out the filenames of my multi upload form, however Javascript is just adding the first item only.