8000 core/server.js at master · jguarecuco/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
{"payload":{"allShortcutsEnabled":false,"fileTree":{"":{"items":[{"name":"bin","path":"bin","contentType":"directory"},{"name":"build","path":"build","contentType":"directory"},{"name":"conf","path":"conf","contentType":"directory"},{"name":"configs","path":"configs","contentType":"directory"},{"name":"docs","path":"docs","contentType":"directory"},{"name":"local","path":"local","contentType":"directory"},{"name":"node_modules","path":"node_modules","contentType":"directory"},{"name":"plugins","path":"plugins","contentType":"directory"},{"name":"scripts","path":"scripts","contentType":"directory"},{"name":"settings","path":"settings","contentType":"directory"},{"name":"test","path":"test","contentType":"directory"},{"name":"user-plugins","path":"user-plugins","contentType":"directory"},{"name":".eslintignore","path":".eslintignore","contentType":"file"},{"name":".eslintrc","path":".eslintrc","contentType":"file"},{"name":".gitignore","path":".gitignore","contentType":"file"},{"name":".nakignore","path":".nakignore","contentType":"file"},{"name":"LICENSE","path":"LICENSE","contentType":"file"},{"name":"LICENSE-COMMERCIAL-USE","path":"LICENSE-COMMERCIAL-USE","contentType":"file"},{"name":"NOTICE","path":"NOTICE","contentType":"file"},{"name":"README.md","path":"README.md","contentType":"file"},{"name":"package.json","path":"package.json","contentType":"file"},{"name":"server.js","path":"server.js","contentType":"file"}],"totalCount":22}},"fileTreeProcessingTime":4.474392,"foldersToFetch":[],"incompleteFileTree":false,"repo":{"id":127644583,"defaultBranch":"master","name":"core","ownerLogin":"jguarecuco","currentUserCanPush":false,"isFork":true,"isEmpty":false,"createdAt":"2018-04-01T15:48:21.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/8439427?v=4","public":true,"private":false,"isOrgOwned":false},"codeLineWrapEnabled":false,"symbolsExpanded":false,"treeExpanded":true,"refInfo":{"name":"master","listCacheKey":"v0:1616822259.724739","canEdit":false,"refType":"branch","currentOid":"7ebc71b989e92db8c9d0dbaa65a2d061cb074426"},"path":"server.js","currentUser":null,"blob":{"rawLines":["#!/usr/bin/env node","\"use strict\";","","require(\"amd-loader\");","try {"," require(\"heapdump\");","} catch(e) {}","","var path = require(\"path\");","var architect = require(\"architect\");","var os = require(\"os\");","var urls = require(\"c9/urls\");","var hostname = require(\"c9/hostname\");","var child_process = require(\"child_process\");","require(\"c9/setup_paths.js\");","","if (process.version.match(/^v0/) \u0026\u0026 parseFloat(process.version.substr(3)) \u003c 10) {"," console.warn(\"You're using Node.js version \" + process.version "," + \". Version 0.10 or higher is recommended. Some features will not work.\");","}","","var DEFAULT_CONFIG = \"s\";","var DEFAULT_SETTINGS = getDefaultSettings();","","var shortcuts = {"," \"dev\": [\"ide\", \"preview\", \"user-content\", \"vfs\", \"api\", \"sapi\", \"proxy\", \"redis\", \"profile\", \"oldclient\", \"homepage\", \"apps-proxy\", \"-s\", \"devel\"],"," \"onlinedev\": [\"ide\", \"preview\", \"user-content\", \"vfs\", \"api\", \"proxy\", \"oldclient\", \"homepage\", \"apps-proxy\", \"profile\", \"-s\", \"onlinedev\"],"," \"beta\": [\"ide\", \"preview\", \"user-content\", \"vfs\", \"proxy\", \"-s\", \"beta\"],"," \"s\": [\"standalone\", \"-s\", \"standalone\"],","};","shortcuts.localdev = shortcuts.onlinedev.concat(["," \"-s\", \"beta\","," \"--ide.packed\", \"false\","," \"--ide.cdn\", \"false\","," \"--ide.forceDev\", \"true\","," \"--homepage.cdn\", \"false\","," \"--helpWithSudo\","," \"--api.port\", \"8281\","," \"--infra_port\", \"8282\","," \"--api_url\", \"http://api.c9.local:8281\","," \"--domains\", \"c9.local\","," \"--cdn.abbreviateVersion\", \"true\",","]);","shortcuts.odev = shortcuts.onlinedev; // For backwards compatibility, if you see this in 2016 remove this line","var delayLoadConfigs = ["," // Services that are usually not immediately needed"," \"preview\", \"user-content\", \"apps-proxy\", \"worker\", \"homepage\","," // Services that are very slow to load, blocking others"," \"profile\",","];","","module.exports = main;","","if (!module.parent)"," main(process.argv.slice(2));","","function getDefaultSettings() {"," var suffix = hostname.parse(os.hostname()).env;"," var modes = {"," \"workflowstaging\": \"workflow-staging\","," \"prod\": \"deploy\","," \"beta\": \"beta\","," \"dev\": \"devel\","," \"onlinedev\": \"onlinedev\","," \"test\": \"test\""," };"," return modes[suffix] || \"devel\";","}","","module.exports.getDefaultSettings = getDefaultSettings;","","function main(argv, config, onLoaded) {"," var inContainer = os.hostname().match(/^\\w+-\\w+-\\d+$/);"," var optimist = require(\"optimist\");"," var async = require(\"async\");",""," var options = optimist(argv)"," .usage(\"Usage: $0 [CONFIG_NAME] [--help]\")"," .alias(\"s\", \"settings\")"," .default(\"settings\", DEFAULT_SETTINGS)"," .describe(\"settings\", \"Settings file to use\")"," .describe(\"dump\", \"dump config file as JSON\")"," .describe(\"domains\", \"Primary and any secondary top-level domains to use (e.g, c9.io,c9.dev)\")"," .describe(\"exclude\", \"Exclude specified service\")"," .describe(\"include\", \"Include only specified service\")"," .describe(\"helpWithSudo\", \"Ask for sudo password on startup\")"," .default(\"domains\", inContainer \u0026\u0026 [process.env.C9_HOSTNAME || process.env.C9_DOMAINS, \"c9.io\"])"," .boolean(\"help\")"," .describe(\"help\", \"Show command line options.\");",""," var configs = options.argv._;"," if (!configs.length) "," configs = [config || DEFAULT_CONFIG];"," "," var exclude = options.argv.exclude || [];"," if (typeof exclude == \"string\")"," exclude = exclude.split(\",\");",""," var expanded = expandShortCuts(configs);",""," if (expanded.length \u003e configs.length)"," return main(expanded.concat(argv.filter(function(arg) {"," return !shortcuts[arg];"," })), config, onLoaded);",""," if (options.argv.include)"," expanded = [].concat(options.argv.include);"," "," var delayed = expanded.filter(function(c) { return delayLoadConfigs.indexOf(c) !== -1 });"," var notDelayed = expanded.filter(function(c) { return delayLoadConfigs.indexOf(c) === -1 });"," "," if (options.argv.helpWithSudo)"," return child_process.execFile(\"sudo\", [\"echo -n\"], main.bind(null, argv.filter(function(a) {"," return a !== \"--helpWithSudo\";"," }), config, onLoaded));"," "," startConfigs(notDelayed, function() {"," startConfigs(delayed, function() {"," console.log(\"Cloud9 is up and running\");"," });"," });"," "," function startConfigs(configs, done) {"," async.each(configs, function(config, next) {"," if (exclude \u0026\u0026 exclude.indexOf(config) \u003e -1)"," return next();"," start(config, options, function(err, result, path) {"," onLoaded \u0026\u0026 onLoaded(err, result, path);"," next(err);"," });"," }, done);"," }","}"," ","function expandShortCuts(configs) {"," var results = configs.slice();"," for (var i = 0; i \u003c results.length; i++) {"," var expanded = shortcuts[results[i]];"," if (expanded) {"," results.splice.apply(results, [i, 1].concat(expanded));"," i += expanded.length - 1;"," }"," }"," return results;","}","","function loadSettings(settingsName) {"," var provider = hostname.parse(os.hostname()).provider;"," var candidates = ["," path.join(__dirname, \"./settings\", settingsName + \"-\" + provider),"," path.join(__dirname, \"./settings\", settingsName)"," ];",""," var settings, settingsModule;"," "," for (var i = 0; i \u003c candidates.length; i++) {"," var settingsPath = candidates[i];"," try {"," settingsModule = require(settingsPath);"," } catch (e) {"," continue;"," }"," settings = settingsModule();"," break;"," "," }"," if (!settings)"," throw new Error(\"No settings found\");"," "," return settings;","}","","module.exports.loadSettings = loadSettings;","","function start(configName, options, callback) {"," console.log(\"Starting\", configName);"," "," var argv = options.argv;"," var settingsName = argv.settings;"," "," if (typeof settingsName != \"string\")"," settingsName = settingsName.pop();"," "," var configPath = configName;"," if (configPath[0] !== \"/\")"," configPath = path.join(__dirname, \"/configs/\", configName);"," "," var settings = loadSettings(settingsName);"," "," argv.domains = argv.domains || settings.domains;"," if (settings.c9 \u0026\u0026 argv.domains)"," urls.replaceDomains(settings, argv.domains);",""," var plugins = require(configPath)(settings, options);"," "," if (argv.help) {"," options.usage(\"Usage: $0 \" + configName);"," options.showHelp();"," }"," "," if (!plugins)"," return;"," "," if (module.exports.onResolvePlugins)"," module.exports.onResolvePlugins(plugins, __dirname + \"/plugins\");"," "," architect.resolveConfig(plugins, __dirname + \"/plugins\", function(err, config) {"," if (err) {"," console.error(err.stack || err);"," process.exit(1);"," }"," "," if (argv.dump) {"," console.log(JSON.stringify(config, null, 2));"," return callback \u0026\u0026 callback(null, config);"," }"," "," if (argv._getConfig)"," return callback \u0026\u0026 callback(null, config, configPath);",""," var app = architect.createApp(config, function (err, app) {"," if (err) {"," console.trace(\"Error while starting '%s':\", configPath);"," console.log(err, err.stack);"," process.exit(1);"," }"," console.log(\"Started '%s' with config '%s'!\", configPath, settingsName);"," "," callback \u0026\u0026 callback(null, app);"," });"," "," app.on(\"service\", function(name, plugin) {"," if (typeof plugin !== \"function\")"," plugin.name = name; "," });"," });","}"],"stylingDirectives":null,"colorizedLines":null,"csv":null,"csvError":null,"dependabotInfo":{"showConfigurationBanner":false,"configFilePath":null,"networkDependabotPath":"/jguarecuco/core/network/updates","dismissConfigurationNoticePath":"/settings/dismiss-notice/dependabot_configuration_notice","configurationNoticeDismissed":null},"displayName":"server.js","displayUrl":"https://github.com/jguarecuco/core/blob/master/server.js?raw=true","headerInfo":{"blobSize":"7.53 KB","deleteTooltip":"You must be signed in to make or propose changes","editTooltip":"You must be signed in to make or propose changes","ghDesktopPath":"https://desktop.github.com","isGitLfs":false,"onBranch":true,"shortPath":"72a761b","siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2Fjguarecuco%2Fcore%2Fblob%2Fmaster%2Fserver.js","isCSV":false,"isRichtext":false,"toc":null,"lineInfo":{"truncatedLoc":"237","truncatedSloc":"194"},"mode":"executable file"},"image":false,"isCodeownersFile":null,"isPlain":false,"isValidLegacyIssueTemplate":false,"issueTemplate":null,"discussionTemplate":null,"language":"JavaScript","languageID":183,"large":false,"planSupportInfo":{"repoIsFork":null,"repoOwnedByCurrentUser":null,"requestFullPath":"/jguarecuco/core/blob/master/server.js","showFreeOrgGatedFeatureMessage":null,"showPlanSupportBanner":null,"upgradeDataAttributes":null,"upgradePath":null},"publishBannersInfo":{"dismissActionNoticePath":"/settings/dismiss-notice/publish_action_from_dockerfile","releasePath":"/jguarecuco/core/releases/new?marketplace=true","showPublishActionBanner":false},"rawBlobUrl":"https://github.com/jguarecuco/core/raw/refs/heads/master/server.js","renderImageOrRaw":false,"richText":null,"renderedFileInfo":null,"shortPath":null,"symbolsEnabled":true,"tabSize":8,"topBannersInfo":{"overridingGlobalFundingFile":false,"globalPreferredFundingPath":null,"showInvalidCitationWarning":false,"citationHelpUrl":"https://docs.github.com/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-citation-files","actionsOnboardingTip":null},"truncated":false,"viewable":true,"workflowRedirectUrl":null,"symbols":{"timed_out":false,"not_analyzed":false,"symbols":[{"name":"getDefaultSettings","kind":"function","ident_start":1912,"ident_end":1930,"extent_start":1903,"extent_end":2228,"fully_qualified_name":"getDefaultSettings","ident_utf16":{"start":{"line_number":56,"utf16_col":9},"end":{"line_number":56,"utf16_col":27}},"extent_utf16":{"start":{"line_number":56,"utf16_col":0},"end":{"line_number":67,"utf16_col":1}}},{"name":"main","kind":"function","ident_start":2296,"ident_end":2300,"extent_start":2287,"extent_end":4704,"fully_qualified_name":"main","ident_utf16":{"start":{"line_number":71,"utf16_col":9},"end":{"line_number":71,"utf16_col":13}},"extent_utf16":{"start":{"line_number":71,"utf16_col":0},"end":{"line_number":132,"utf16_col":1}}},{"name":"startConfigs","kind":"function","ident_start":4343,"ident_end":4355,"extent_start":4334,"extent_end":4702,"fully_qualified_name":"startConfigs","ident_utf16":{"start":{"line_number":122,"utf16_col":13},"end":{"line_number":122,"utf16_col":25}},"extent_utf16":{"start":{"line_number":122,"utf16_col":4},"end":{"line_number":131,"utf16_col":5}}},{"name":"expandShortCuts","kind":"function","ident_start":4720,"ident_end":4735,"extent_start":4711,"extent_end":5042,"fully_qualified_name":"expandShortCuts","ident_utf16":{"start":{"line_number":134,"utf16_col":9},"end":{"line_number":134,"utf16_col":24}},"extent_utf16":{"start":{"line_number":134,"utf16_col":0},"end":{"line_number":144,"utf16_col":1}}},{"name":"loadSettings","kind":"function","ident_start":5053,"ident_end":5065,"extent_start":5044,"extent_end":5718,"fully_qualified_name":"loadSettings","ident_utf16":{"start":{"line_number":146,"utf16_col":9},"end":{"line_number":146,"utf16_col":21}},"extent_utf16":{"start":{"line_number":146,"utf16_col":0},"end":{"line_number":170,"utf16_col":1}}},{"name":"start","kind":"function","ident_start":5774,"ident_end":5779,"extent_start":5765,"extent_end":7710,"fully_qualified_name":"start","ident_utf16":{"start":{"line_number":174,"utf16_col":9},"end":{"line_number":174,"utf16_col":14}},"extent_utf16":{"start":{"line_number":174,"utf16_col":0},"end":{"line_number":236,"utf16_col":1}}}]}},"copilotInfo":null,"copilotAccessAllowed":false,"modelsAccessAllowed":false,"modelsRepoIntegrationEnabled":false,"csrf_tokens":{"/jguarecuco/core/branches":{"post":"DTARxcd1MYK_bbZjWuK6E5LwQ3nhhvmLEiSDTRe79uUj2Ezbi6Q2b3ewvld-ESm1EwMBXb9s0tEosJGrSfAFmQ"},"/repos/preferences":{"post":"8OvrDuLflOV4SoE58p7jUiHXyduycvcnFRVtZ81bZ9X_ntEhsfSoZE3UL7Ijm1LuYLneM92cgsaysF6N9xhFKA"}}},"title":"core/server.js at master · jguarecuco/core","appPayload":{"helpUrl":"https://docs.github.com","findFileWorkerPath":"/assets-cdn/worker/find-file-worker-7d7eb7c71814.js","findInFileWorkerPath":"/assets-cdn/worker/find-in-file-worker-1ae9fa256942.js","githubDevUrl":null,"enabled_features":{"code_nav_ui_events":false,"react_blob_overlay":false,"accessible_code_button":true,"github_models_repo_integration":false}}}
0