Initial commit
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
ztncui - ZeroTier network controller UI
|
||||
Copyright (C) 2017 Key Networks (https://key-networks.com)
|
||||
Licensed under GPLv3 - see LICENSE for details.
|
||||
*/
|
||||
|
||||
const fs = require('fs');
|
||||
const util = require('util');
|
||||
|
||||
const readFile = util.promisify(fs.readFile);
|
||||
|
||||
let _token = null;
|
||||
|
||||
exports.get = async function() {
|
||||
if (_token) {
|
||||
return _token;
|
||||
} else {
|
||||
try {
|
||||
_token = await readFile('/var/lib/zerotier-one/authtoken.secret', 'utf8');
|
||||
return _token;
|
||||
} catch(err) {
|
||||
throw(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user