File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import { Injectable , OnDestroy } from '@angular/core' ;
1+ import { DOCUMENT } from '@angular/common' ;
2+ import { Inject , Injectable , OnDestroy } from '@angular/core' ;
23import * as neo4j from 'neo4j-driver' ;
34import { tap } from 'rxjs/operators' ;
45import { environment } from 'src/environments/environment' ;
@@ -8,9 +9,9 @@ import { environment } from 'src/environments/environment';
89} )
910export default class Neo4jService implements OnDestroy {
1011 driver : neo4j . Driver ;
11- constructor ( ) {
12+ constructor ( @ Inject ( DOCUMENT ) private document : { location : any } ) {
1213 this . driver = neo4j . driver (
13- environment . neo4j . url ,
14+ environment . neo4j . url ( this . document . location ) ,
1415 neo4j . auth . basic (
1516 environment . neo4j . username ,
1617 environment . neo4j . password
Original file line number Diff line number Diff line change 11export const environment = {
22 neo4j : {
3- url : 'neo4j://neo4j.lume.m-ptr.de:7687' ,
3+ url : ( location : any ) => {
4+ if ( location . hostname === 'localhost' ) return "neo4j://localhost" ;
5+ else return `neo4j://neo4j.${ location . hostname } :7687`
6+ } ,
47 username : 'readonly' ,
58 password : 'well-known' ,
69 } ,
Original file line number Diff line number Diff line change 44
55export const environment = {
66 neo4j : {
7- url : 'neo4j://localhost' ,
7+ url : ( location : any ) => 'neo4j://localhost' ,
88 username : 'neo4j' ,
99 password : 's3cr3t4' ,
1010 } ,
You can’t perform that action at this time.
0 commit comments