You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+28-8Lines changed: 28 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,21 +27,41 @@ Or install it yourself as:
27
27
28
28
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):
29
29
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`
36
36
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:
38
38
39
39
```ruby
40
40
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
42
47
end
43
48
```
44
49
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
+
45
65
## Usage
46
66
47
67
The core interface can be directly accessed on `Neo4::Http::Client` -
0 commit comments