mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
19 lines
443 B
JavaScript
19 lines
443 B
JavaScript
import { v1 as neo4j } from 'neo4j-driver'
|
|
import dotenv from 'dotenv'
|
|
|
|
dotenv.config()
|
|
|
|
let driver
|
|
|
|
export function getDriver (options = {}) {
|
|
const {
|
|
uri = process.env.NEO4J_URI || 'bolt://localhost:7687',
|
|
username = process.env.NEO4J_USERNAME || 'neo4j',
|
|
password = process.env.NEO4J_PASSWORD || 'neo4j'
|
|
} = options
|
|
if (!driver) {
|
|
driver = neo4j.driver(uri, neo4j.auth.basic(username, password))
|
|
}
|
|
return driver
|
|
}
|