Doc about env variables for workspace URL etc.?


Hi, just quickly looked through the docs and didn’t find any reference on how to get the workspace URL for use e.g. inside nodejs to pass it to browserSync… Is there a doc that tells me the official ENV variables?


Hey @philkunz,

Pardon I don’t have a direct answer but can direct you to these docs:

:books: :snail:


Ok, I looked through the links, and as far as I can see they all suggest access to process.env.ip

however c9 workspaces use a proxy to relay traffic so I don’t have access to a unique workspace ip. instead the traffic is routed to the right droplet by evaluating host headers…

because of this I asked for an env variable that provides access to the workspace URL, not the IP.

process.env.ip and just make sure a running server process is actually accessible through the proxy since c9 only routes specific ports by default…


Maybe experiment and see if there is a process.env.url and if not maybe you can get the url from the process.env.ip:

:book: :monkey:


Here you go:


offers data about current workspace

Project Status

Build Status


to install simply type

npm install c9config


var c9config = require("c9config");
c9config.isC9 // true or false depending wether on C9 or not.
c9config.print() // prints an overview of the important information to console
c9config.workspace // an object that holds the important worspace information
/* ----------- object currently looks like this ------
 *  {
 *      isC9: true,
 *      name: 'workspacename',
 *      owner: 'username',
 *      ideUrl: '',
 *      serveUrl: ''
 *  }


Here you go:
However I still need to find a way to reliably get the workspacename…


Does the workspacename have to be discovered programmatically or could it be hardcoded into a variable?


Anything else than programmatically renders the whole package useless…

Cloud9 as an IDE is nice for quickly testing things and making small changes, because I can quickly create a new workspace… I don’t want to hardcode the workspacename every time I create a new workspace…

Cloud9 currently still lacks basic features concerning smart code validation and refactoring like WebStorm offers, so I don’t use it for big projects where the projectsize would justify to hardcode anything…

the c9config package is thought as a npm devDependency where I can quickly type things like

npm install
npm run testBrowser

right after creating the workspace from a github repo.


This package has several bugs. I proposed the fixes on the issues tab of the repository. Here is the code fixed:

var c9workspace = {
    isC9: false,
    name: "undefined",
    owner: "undefined",
    ideUrl: "undefined",
    serverUrl: "undefined"
(function () {
    c9workspace.isC9 = (function () { if (process.env.C9_USER === undefined) {
        return false;
    else {
        return true;
    } })();
    c9workspace.owner = process.env.C9_USER; = process.env.C9_PROJECT;
    c9workspace.ideUrl = "" + process.env.C9_USER + "/" +;
    c9workspace.serverUrl = "https://" + + "-" + c9workspace.owner + "";
var c9config = {
    isC9: c9workspace.isC9,
    print: function () {
    workspace: c9workspace
module.exports = c9config;