apigee-templater-module
Advanced tools
Comparing version 0.4.3 to 0.4.4
@@ -15,3 +15,3 @@ "use strict"; | ||
<Request> | ||
{{#each pf_rq_policies}} | ||
{{#each preflow_request_policies}} | ||
<Step> | ||
@@ -32,3 +32,3 @@ <Name>{{this}}</Name> | ||
</HTTPProxyConnection> | ||
<RouteRule name="default"> | ||
<RouteRule name="{{targetName}}"> | ||
<TargetEndpoint>{{targetName}}</TargetEndpoint> | ||
@@ -41,3 +41,10 @@ </RouteRule> | ||
return new Promise((resolve, reject) => { | ||
fs_1.default.writeFileSync(outputDir + "/proxies/default" + ".xml", this.template({ basePath: inputConfig.basePath, targetName: inputConfig.targetName, pf_rq_policies: processingVars["pf_rq_policies"] })); | ||
fs_1.default.writeFileSync(outputDir + "/proxies/" + inputConfig.name + ".xml", this.template({ | ||
basePath: inputConfig.basePath, | ||
targetName: inputConfig.targetName, | ||
preflow_request_policies: processingVars["preflow_request_policies"], | ||
preflow_response_policies: processingVars["preflow_response_policies"], | ||
postflow_request_policies: processingVars["postflow_request_policies"], | ||
postflow_response_policies: processingVars["postflow_response_policies"], | ||
})); | ||
resolve(true); | ||
@@ -44,0 +51,0 @@ }); |
@@ -12,3 +12,3 @@ "use strict"; | ||
this.snippet = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<TargetEndpoint name="default"> | ||
<TargetEndpoint name="{{targetName}}"> | ||
<PreFlow name="PreFlow"> | ||
@@ -31,3 +31,3 @@ <Request/> | ||
return new Promise((resolve, reject) => { | ||
fs_1.default.writeFileSync(outputDir + "/targets/" + inputConfig.targetName + ".xml", this.template({ targetUrl: inputConfig.targetUrl })); | ||
fs_1.default.writeFileSync(outputDir + "/targets/" + inputConfig.targetName + ".xml", this.template({ targetNale: inputConfig.targetName, targetUrl: inputConfig.targetUrl })); | ||
resolve(true); | ||
@@ -34,0 +34,0 @@ }); |
@@ -10,17 +10,21 @@ "use strict"; | ||
const auth_sf_plugin_1 = require("./plugins/auth.sf.plugin"); | ||
const auth_apikey_plugin_1 = require("./plugins/auth.apikey.plugin"); | ||
const traffic_quota_plugin_1 = require("./plugins/traffic.quota.plugin"); | ||
const traffic_spikearrest_plugin_1 = require("./plugins/traffic.spikearrest.plugin"); | ||
const archiver_1 = __importDefault(require("archiver")); | ||
const fs_1 = __importDefault(require("fs")); | ||
let plugins = [ | ||
// First apply spike arrest, if configured | ||
//new SpikeArrestPlugin(), | ||
// Then developer identity and quotas | ||
// new AuthApiKeyPlugin(), | ||
new auth_sf_plugin_1.AuthSfPlugin(), | ||
// new QuotaPlugin(), | ||
// Then targets, endpoints and manifest | ||
new targets_plugin_1.TargetsPlugin(), | ||
new proxies_plugin_1.ProxiesPlugin(), | ||
// new ManifestPlugin() | ||
]; | ||
class ApigeeGenerator { | ||
constructor(plugins) { | ||
// Default Plugins | ||
this.plugins = [ | ||
new traffic_spikearrest_plugin_1.SpikeArrestPlugin(), | ||
new auth_apikey_plugin_1.AuthApiKeyPlugin(), | ||
new auth_sf_plugin_1.AuthSfPlugin(), | ||
new traffic_quota_plugin_1.QuotaPlugin(), | ||
new targets_plugin_1.TargetsPlugin(), | ||
new proxies_plugin_1.ProxiesPlugin(), | ||
]; | ||
if (plugins) | ||
this.plugins = plugins; | ||
} | ||
generateProxy(genInput, outputDir) { | ||
@@ -36,3 +40,8 @@ return new Promise((resolve, reject) => { | ||
for (let endpoint of genInput.proxyEndpoints) { | ||
for (let plugin of plugins) { | ||
// Initialize variables for endpoint | ||
processingVars["preflow_request_policies"] = []; | ||
processingVars["preflow_response_policies"] = []; | ||
processingVars["postflow_request_policies"] = []; | ||
processingVars["postflow_response_policies"] = []; | ||
for (let plugin of this.plugins) { | ||
let result = plugin.applyTemplate(endpoint, processingVars, newOutputDir); | ||
@@ -39,0 +48,0 @@ } |
{ | ||
"name": "apigee-templater-module", | ||
"version": "0.4.3", | ||
"version": "0.4.4", | ||
"description": "This library provides templating services for Apigee X proxies.", | ||
"homepage": "https://github.com/tyayers/apigee-templater", | ||
"bugs": "https://github.com/tyayers/apigee-templater/issues", | ||
"scripts": { | ||
@@ -6,0 +8,0 @@ "test": "echo \"Error: no test specified\" && exit 1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
32171
33
461
2
10