Skip to content

Commit c77eda5

Browse files
authored
Merge pull request #6 from doximity/bls-improve-README-on-config
Clarify configuration and ENV values
2 parents 17a98a7 + c8e5162 commit c77eda5

File tree

7 files changed

+37
-12
lines changed

7 files changed

+37
-12
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
Changelog
22
=========
33

4+
## v1.0.1 05/24/2022
5+
* Expand documentation configuration settings
6+
47
## v1.0.0 04/28/2022
58
* Initial gem extraction from Doximity
69

Gemfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
neo4j-http (1.0.0)
4+
neo4j-http (1.0.1)
55
activesupport (>= 5.2)
66
faraday (< 2)
77
faraday-retry
@@ -10,7 +10,7 @@ PATH
1010
GEM
1111
remote: https://rubygems.org/
1212
specs:
13-
activesupport (7.0.2.4)
13+
activesupport (7.0.3)
1414
concurrent-ruby (~> 1.0, >= 1.0.2)
1515
i18n (>= 1.6, < 2)
1616
minitest (>= 5.1)
@@ -106,4 +106,4 @@ DEPENDENCIES
106106
standard
107107

108108
BUNDLED WITH
109-
2.1.4
109+
2.3.0

README.md

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,41 @@ Or install it yourself as:
2727

2828
The client is configured by default via a set of environment variables from [Neo4j::Http::Configuration](https://github.com/doximity/neo4j-http/blob/master/lib/neo4j/http/configuration.rb):
2929

30-
* `NEO4J_URL` - The base URL to connect to Neo4j at
31-
* `NEO4J_USER` - The user name to use when authenticating to neo4j
32-
* `NEO4J_PASSWORD` - The password of the user to be used for authentication
33-
* `NEO4J_DATABASE` - The database name to be used when connecting. By default this will be nil and the path used for connecting to Neo4j wil be `/db/data/transaction/commit` to make it compliant with v3.5 of neo4j
34-
* `NEO4J_HTTP_USER_AGENT` - The user agent name provided in the request - defaults to `Ruby Neo4j Http Client`
35-
* `NEO4J_REQUEST_TIMEOUT_IN_SECONDS` - The number of seconds for the http request to time out if provided, defaults to nil
30+
* `NEO4J_URL` - The base URL to connect to Neo4j at - defaults to `"http://localhost:7474"`
31+
* `NEO4J_USER` - The user name to use when authenticating to neo4j - defaults to `""`
32+
* `NEO4J_PASSWORD` - The password of the user to be used for authentication - defaults to `""`
33+
* `NEO4J_DATABASE` - The database name to be used when connecting. By default this will be `nil`.
34+
* `NEO4J_HTTP_USER_AGENT` - The user agent name provided in the request - defaults to `"Ruby Neo4j Http Client"`
35+
* `NEO4J_REQUEST_TIMEOUT_IN_SECONDS` - The number of seconds for the http request to time out if provided - defaults to `nil`
3636

37-
These configuration values can also be set during initalization like:
37+
These configuration values can also be set during initalization, and take precedence over the environment variables:
3838

3939
```ruby
4040
Neo4j::Http.configure do |config|
41-
config.request_timeout_in_seconds = 42
41+
config.uri = "http://localhost:7474"
42+
config.user = ""
43+
config.password = ""
44+
config.database_name = nil
45+
config.user_agent = "Ruby Neo4j Http Client"
46+
config.request_timeout_in_seconds = nil
4247
end
4348
```
4449

50+
### Multiple databases
51+
52+
The HTTP API endpoints [follow the pattern](https://neo4j.com/docs/upgrade-migration-guide/current/migration/surface-changes/http-api/) `/db/<NEO4J_DATABASE>/tx`
53+
54+
To route to a different database, set a value for `NEO4J_DATABASE`. If no value is supplied, or this ENV is unset, the URI defaults to `/db/data/transaction/commit`
55+
56+
This can be used for testing by setting up a test environment only variable using a gem like [dotenv-rails](https://github.com/bkeepers/dotenv):
57+
58+
```
59+
# .env.testing
60+
NEO4J_DATABASE=test
61+
```
62+
63+
All testing operations are now routed to the URI `/db/test/tx/commit`.
64+
4565
## Usage
4666

4767
The core interface can be directly accessed on `Neo4::Http::Client` -

lib/neo4j/http/configuration.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ def initialize(options = ENV)
1919
@request_timeout_in_seconds = options.fetch("NEO4J_REQUEST_TIMEOUT_IN_SECONDS", nil)
2020
end
2121

22+
# https://neo4j.com/developer/manage-multiple-databases/
23+
# https://neo4j.com/docs/upgrade-migration-guide/current/migration/surface-changes/http-api/
2224
def transaction_path
2325
# v3.5 - /db/data/transaction/commit
2426
# v4.x - /db/#{database_name}/tx/commit

lib/neo4j/http/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module Neo4j
22
module Http
3-
VERSION = "1.0.0"
3+
VERSION = "1.0.1"
44
end
55
end
-218 KB
Binary file not shown.

vendor/cache/activesupport-7.0.3.gem

218 KB
Binary file not shown.

0 commit comments

Comments
 (0)