and then get the environment variables from the running environment like this:

app.set('port', process.env.PORT);

The defined environment variables are:

NAME
PORT
NODE_ENV
MONGO_HOST
MONGO_PORT
MONGO_REPLSET

Network access

This charm does not open any public ports itself.
The intention is to relate it to a proxy service likehaproxy, which will in turn open port 80 to the outside world.
This allows for instant horizontal scalability.

If your node app is itself a proxy and you want it directly exposed,
this can easily be done by adding

open-port $app_port

to the bottom of the install hook, and then once your stack
is started, you expose

juju expose myapp

it to the outside world.

By default, juju services within the same environment
can talk to each other on any port over
internal network interfaces.

Making this work with your node.js app

This charm makes some strong assumptions
about the structure of the node application
(config/config.js) that might not apply to your app.
Please treat this formula as a template that
you can fork and modify to suit your needs.

The biggest difference between how the charm
behaves for different kind of apps is application
startup. A simple application will want to start
upon install (startup code goes in the install hook),
whereas some applications will not want
to start up until a database has be associated
(startup code goes in the db-relation-joined hooks).