0

Is there a way to inject URI in the ogm.properties (spring data neo4j) using environment variable ?

e.g. URI=http://neo4j:neo4j@localhost:7474 works fine; however if I try this: URI=http://${userid}:${pwd}@${hostName}:7474 and supply those as the environment variables does not work.

At runtime, spring data neo4j accesses the url as is without replacing the variable values.

Luanne
  • 19,145
  • 1
  • 39
  • 51
Rakesh
  • 235
  • 2
  • 10

1 Answers1

2

This is not supported. Please use the Java configuration instead of ogm.properties instead, then you're free to read environment variables.

Example:

@Bean
public Configuration getConfiguration() {
   Configuration config = new Configuration();
   config
       .driverConfiguration()
       .setDriverClassName("org.neo4j.ogm.drivers.http.driver.HttpDriver")
       .setURI(uri)
       .setCredentials(username,password);

   return config;
}
Luanne
  • 19,145
  • 1
  • 39
  • 51
  • Just an update, mmaybe it works now : http://docs.spring.io/spring-data/neo4j/docs/current/reference/html/#_connecting_to_neo4j – 89n3ur0n Mar 01 '17 at 15:01