mirror of https://github.com/embarklabs/embark.git
minor refactor on setprovider code
This commit is contained in:
parent
e8ebb0fb37
commit
c4e13f9ea8
|
@ -220,15 +220,12 @@ class CodeGenerator {
|
|||
result += Templates.define_when_env_loaded();
|
||||
|
||||
let block;
|
||||
//if (self.communicationConfig.enabled === true && ['whisper', 'orbit'].indexOf(self.communicationConfig.provider) < 0) {
|
||||
// //TODO: add logger; also make sure it would still work with a plugin provider
|
||||
// self.logger.warn("unknown provider " + self.communicationConfig.provider);
|
||||
//}
|
||||
// TODO: refactor this
|
||||
if (self.communicationConfig.provider === 'whisper' && self.communicationConfig.enabled === true) {
|
||||
if (self.communicationConfig.connection === undefined) {
|
||||
block = "\nEmbarkJS.Messages.setProvider('" + self.communicationConfig.provider + "');";
|
||||
} else {
|
||||
block = "\nEmbarkJS.Messages.setProvider('" + self.communicationConfig.provider + "', {server: '" + self.communicationConfig.connection.host + "', port: '" + self.communicationConfig.connection.port + "', type: '" + self.communicationConfig.connection.type + "'});";
|
||||
}
|
||||
result += Templates.exec_when_env_loaded({block: block});
|
||||
} else if (self.communicationConfig.provider === 'orbit' && self.communicationConfig.enabled === true) {
|
||||
if (self.communicationConfig.enabled === true) {
|
||||
if (self.communicationConfig.connection === undefined) {
|
||||
block = "\nEmbarkJS.Messages.setProvider('" + self.communicationConfig.provider + "');";
|
||||
} else {
|
||||
|
@ -236,7 +233,6 @@ class CodeGenerator {
|
|||
}
|
||||
result += Templates.exec_when_env_loaded({block: block});
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue