I don't know how much experience you have with Rails. But in rails you mainly have 3 environments be default:
1- development
2- test
3- production
You can have different configs for different environments as shown in this SO question:
Best way to create custom config options for my Rails app?
Last thing, I would not recommend to use the Neo4j adapter directly unless you are really experienced and need direct access to it because of business requirements.
I'd recommend to use Neo4jrb wrapper around the core adapter as shown here:
https://neo4jrb.readthedocs.io/en/9.2.x/Setup.html#generating-a-new-app
UPDATE
Create a file called neo4j.yml
inside config
directory in your project with following code:
development:
neo4j_api: http://localhost:7474
test:
neo4j_api: http://something_else:7474
production:
neo4j_api: http://maybe_something_else:7474
then create an initializer
in your project lets call it neo4j.rb
so its path should be: config/initializers/neo4j.rb
.
Inside this initializer put the following code:
NEO4J_CONFIG = YAML.load_file(Rails.root.join('config/neo4j.yml'))[Rails.env]
Then you will have the NEO4J_CONFIG
accessible at any part of your rails application like:
NEO4J_CONFIG['neo4j_api']
and your code should look like:
neo4j_adaptor = Neo4j::Core::CypherSession::Adaptors::HTTP.new(NEO4J_CONFIG['neo4j_api'])
neo4j_session = Neo4j::Core::CypherSession.new(neo4j_adaptor)