Use env vars instead of file contents (also allows for easier ci testing)
All checks were successful
Run Tests on Code / test (push) Successful in 25s
All checks were successful
Run Tests on Code / test (push) Successful in 25s
This commit is contained in:
parent
dc27c9bf63
commit
6e7fe75654
1 changed files with 1 additions and 15 deletions
|
@ -5,28 +5,14 @@ export async function load() {
|
|||
const credFile = './credentials.json';
|
||||
const socket = io('https://status.neshweb.net/');
|
||||
|
||||
let credentials = {
|
||||
username: '',
|
||||
password: ''
|
||||
};
|
||||
if (fs.existsSync(credFile)) {
|
||||
const buf = fs.readFileSync(credFile);
|
||||
credentials = JSON.parse(buf.toString());
|
||||
} else {
|
||||
console.error('Credentials File does not exist, Socket.io connection will not work.');
|
||||
}
|
||||
|
||||
console.log(credentials);
|
||||
|
||||
let token = '';
|
||||
|
||||
socket.on('connect', () => {
|
||||
socket.emit(
|
||||
'login',
|
||||
{ username: credentials.username, password: credentials.password, token: '' },
|
||||
{ username: process.env.KUMA_USERNAME, password: process.env.KUMA_PASSWORD, token: '' },
|
||||
(res) => {
|
||||
token = res.token;
|
||||
console.log('Token is:', token);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue