Use env vars instead of file contents (also allows for easier ci testing)
This commit is contained in:
parent
e6cbae1bd6
commit
1872b42d5d
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