Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge #122

Merged
merged 18 commits into from
Jul 2, 2024
Merged

merge #122

Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Allow custom GraphDB repository name
LesterLyu committed Mar 21, 2024
commit ec61e2791ba41d59fe9b9acb1c918e209b8ae0bc
1 change: 1 addition & 0 deletions backend/.env.example
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@ MAIL_PASSWORD="password"
GRAPHDB_ADDRESS="http://127.0.0.1:7200"
GRAPHDB_USERNAME="username"
GRAPHDB_PASSWORD="password"
GRAPHDB_REPO="snmi"

# Custom MongoDB connection string
MONGODB_ADDRESS="mongodb://127.0.0.1:27017/snmi"
1 change: 1 addition & 0 deletions backend/config/index.js
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@ if (isProduction)
const config = {
graphdb: {
addr: isProduction ? 'http://localhost:7200' : `http://${isDocker ? 'host.docker.internal' : 'localhost'}:7200`,
repositoryName: process.env.GRAPHDB_REPO || (process.env.test ? "snmiTest" : "snmi")
},
mongodb: {
addr: isProduction ? 'mongodb://localhost:27017/snmi' : `mongodb://localhost:27017/${process.env.test ? "snmiTest" : "snmi"}`
5 changes: 3 additions & 2 deletions backend/loaders/graphDB.js
Original file line number Diff line number Diff line change
@@ -436,7 +436,7 @@ INSERT DATA {

let url;
for (let query of query_list){
url = `${graphdb.addr}/repositories/snmi/statements?update=${encodeURIComponent(query)}`;
url = `${graphdb.addr}/repositories/${graphdb.repositoryName}/statements?update=${encodeURIComponent(query)}`;

const response = await fetch(url, {
method: 'POST',
@@ -464,7 +464,8 @@ async function load() {
password: graphdb.password,
namespaces,
// The repository name, a new repository will be created if it does not exist.
repositoryName: process.env.test ? "snmiTest" : "snmi",
repositoryName: graphdb.repositoryName,
// Set to true if you want to see SPARQL queries
debug: false
});