Skip to content

Commit 3e60b66

Browse files
committed
hid credentials
1 parent 00bd059 commit 3e60b66

File tree

3 files changed

+8
-18
lines changed

3 files changed

+8
-18
lines changed

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
node_modules
22
package-lock.json
33
nohup.out
4-
build
4+
build
5+
config.json
6+
.vscode

.vscode/settings.json

-4
This file was deleted.

src/server.ts

+5-13
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,7 @@ const typeDefs = require("./schema");
55
const resolvers = require("./resolvers");
66
const SQLSource = require("./sql_datasource");
77
const fs = require("fs");
8-
const ws = require("ws");
9-
const socket_server_port = 5000;
10-
//const dbSource = require('./db')
11-
12-
//websocket server stuff
13-
14-
15-
16-
//apollo graph ql stuff
8+
const credentials = require("../config.json");
179
var db = createStore();
1810

1911
const server = new ApolloServer({
@@ -23,16 +15,16 @@ const server = new ApolloServer({
2315
"db": new SQLSource(db)
2416
}),
2517
context: ({req})=>{
26-
if(req.headers.authorization != "bread123") throw new Error("Unauthorized");
18+
if(req.headers.authorization != credentials.pass) throw new Error("Unauthorized");
2719
}
2820
});
2921

3022
function createStore(){
3123
var db = mysql.createConnection({
3224
host: 'localhost',
33-
user: 'root',
34-
password: 'bread123',
35-
database: 'test_db',
25+
user: credentials.db_user,
26+
password: credentials.db_pass,
27+
database: credentials.db_name,
3628
insecureAuth: true,
3729
multipleStatements: true
3830
})

0 commit comments

Comments
 (0)