Skip to content

Commit

Permalink
Merge pull request #217 from srinandan/master
Browse files Browse the repository at this point in the history
enable windows build for edgemicroctl
  • Loading branch information
srinandan authored Feb 10, 2019
2 parents a6129f2 + c3c5f6b commit 197d7cf
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
31 changes: 31 additions & 0 deletions cli/lib/gateway.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ Gateway.prototype.start = (options) => {
if (configurl) opts.configurl = configurl;
var self = this;
edgeconfig.get(opts, (err, newConfig) => {
if(validator(newConfig) == false && !err) {
err = {};
}
if (err) {
// failed to check new config. so try to check again after pollInterval
console.error('Failed to check for change in Config. Will retry after ' + pollInterval + ' seconds');
Expand Down Expand Up @@ -337,3 +340,31 @@ function hasConfigChanged(oldConfig, newConfig) {
return true;
}
}

function validator(newConfig) {

//checkObject(newConfig.product_to_proxy) &&
//checkObject(newConfig.product_to_api_resource)

if (checkObject(newConfig) &&
checkObject(newConfig.analytics) &&
checkObject(newConfig.analytics.source) &&
checkObject(newConfig.analytics.proxy) &&
checkObject(newConfig.analytics.key) &&
checkObject(newConfig.analytics.secret) &&
checkObject(newConfig.analytics.uri) &&
checkObject(newConfig.edgemicro) &&
checkObject(newConfig.edgemicro.port) &&
checkObject(newConfig.edgemicro.max_connections) &&
checkObject(newConfig.headers) &&
Array.isArray(newConfig.proxies)) {
debug("configuration incomplete or invalid, skipping configuration");
return false;
}

return true;
}

function checkObject (o) {
return (typeof o === 'object' && o instanceof Object && !(o instanceof Array));
}
1 change: 1 addition & 0 deletions kubernetes/edgemicroctl/.goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ builds:
goos:
- linux
- darwin
- windows
archive:
name_template: "{{ .ProjectName }}_{{.Tag}}_{{ .Os }}_{{ .Arch }}"
replacements:
Expand Down

0 comments on commit 197d7cf

Please sign in to comment.