Im useing a proxy on my webserver, which uses the esri web-adapter, and want to know if I can pre configure the proxy settings in the base code of WAB Developer. Its a bit annoying to have to copy and paste in the proxy settings to every map when I export them at a new version.
Solved! Go to Solution.
Chris,
It must be somewhere in there. It is all Javascript, HTML and CSS.Try using Online JavaScript beautifier or one of the many plugins listed on the same website in your favorite IDE/browser.
esri needs to document the inner workings/architecture of WAB developer edition clearly for customers to have increased productivity.
Thanks
Subu
Thanks Subu. I take esri's response as being that this just isn't something they expect people to being doing so they didnt build in a place to obviously do it. Beautifying the code may go long way to help.
Wow thanks to Subu suggesting a JS beautifier I found it pretty quick. I used os.walk python to look in every file for "useProxy" and add any that contained it to a list. Then I just beautified the code in those few files before searching through them. In '\server\rest\apps.js' there is a function called zipApp which does what I expected, edits the app config in the deployment zip. I dont know enough JS to tell if it happens before or after zipping but I plugged 'TEST' into the empty url string, saved, exported and there it is in the config.json in the zipfile. Beautified version below, the url is on line 21.
function zipApp(e, t) { var n = getAppPath(e); n = path.normalize(n); try { fs.existsSync("./apps/zips") || fs.mkdirSync("./apps/zips"); var i = fse.readJsonSync(path.join(getAppPath(e), "config.json")), r = i.portalUrl; "/" !== r.substr(r.length - 1, r.length) && (r += "/"); var o = new JSZip; utils.visitFolderFiles(n, function(e, t, i) { var r, a = e.substr(n.length, e.length); if (i) o.folder(a); else if ("env.js" === a) r = fs.readFileSync(e, { encoding: "utf-8" }), r = r.replace("//apiUrl = ", "apiUrl = "), o.file(a, r); else if ("config.json" === a) { var p = fse.readJsonSync(e); p.httpProxy = { useProxy: !0, alwaysUseProxy: !1, url: "", rules: [] }, p.appId = "", o.file(a, JSON.stringify(p)) } else r = fs.readFileSync(e), o.file(a, r) }); var a = o.generate({ type: "nodebuffer", compression: "DEFLATE" }); fs.writeFileSync(getZipFilePath(e), a, "binary"), t() } catch (p) { console.log(p), t(p) } }
This is awesome. Seems like the development folks could have shared that info with us.
Thanks Chris and Subu!!
All,
I find it very unlikely that the development team will share info about modifying any file associated with the builder portion of WAB (it is minified for a reason).
Oh I agree, but they should expose this in the main interface as something you can set at the start instead of going into the config, which is minified, after export insert the url.
It definitely would make sense for this to be an option, which is why we've opened a new enhancement for it. Unfortunately there's no word on whether or not it will be implemented, or when it would be. But the request is in to that team.