mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
refactor(cloudcmd) readConfig: add encoding
This commit is contained in:
parent
1fc1199f31
commit
bd1ecc950e
1 changed files with 6 additions and 7 deletions
13
cloudcmd.js
13
cloudcmd.js
|
|
@ -181,16 +181,15 @@
|
|||
});
|
||||
}
|
||||
|
||||
function readConfig(pCallBack) {
|
||||
fs.readFile(CONFIG_PATH, function(pError, pData) {
|
||||
var msg, status, str, readed;
|
||||
function readConfig(callback) {
|
||||
fs.readFile(CONFIG_PATH, 'utf8', function(error, data) {
|
||||
var msg, status, readed;
|
||||
|
||||
if (pError)
|
||||
if (error)
|
||||
status = 'error';
|
||||
else {
|
||||
status = 'ok';
|
||||
str = pData.toString(),
|
||||
readed = Util.parseJSON(str);
|
||||
readed = Util.parseJSON(data);
|
||||
|
||||
main.config = Config = readed;
|
||||
}
|
||||
|
|
@ -198,7 +197,7 @@
|
|||
msg = CloudFunc.formatMsg('read', 'config', status);
|
||||
Util.log(msg);
|
||||
|
||||
Util.exec(pCallBack);
|
||||
Util.exec(callback);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue