Skip to content
This repository has been archived by the owner on Apr 6, 2021. It is now read-only.

Arbitrary port should be propagated to other plugins? #8

Open
rngadam opened this issue Oct 19, 2012 · 0 comments
Open

Arbitrary port should be propagated to other plugins? #8

rngadam opened this issue Oct 19, 2012 · 0 comments

Comments

@rngadam
Copy link

rngadam commented Oct 19, 2012

Given a listen port of value 0, the OS will select a random, available port automatically. In an architect system, the real port can be retrieved as follow:

    architect.createApp(
        architect.resolveConfig(
            plugins,
            path.join(dirname, 'plugins-server')),
        function (err, app) {
           if (err) {
               console.error("While starting the '%s' for '%s':", dirname, workdir);
               cb(err);
           } else {
               console.log("Started '%s' for '%s'!", dirname, workdir);
               var address = app.services.http.getServer().address();
               cb(null, address);
           }
        }
    );

However, due to the plugin nature of Architect, this system selected port is not propagated to other modules that depend on that port.

In Cloud9 for example we have these configuration directives that directly take the port:

            packagePath: "./cloud9.core",
            debug: false,
            fsUrl: fsUrl,
            smithIo: {
                port: port,
                prefix: "/smith.io/server"
            },

or:

        }, {
            packagePath: "vfs-architect/http-adapter",
            mount: vfsUrl,
            httpRoot: "http://localhost:" + port + vfsUrl
        }, {
            packagePath: "./cloud9.fs",
            urlPrefix: fsUrl
        },
        "./cloud9.socket",
        {
            packagePath: "connect-architect/connect.session",
            key: "cloud9.sid." + port,
            secret: "v1234"
        },

...although my Cloud9 instance "seems" to be working (without any error on the console) with this arbitrary port, I'm wondering about the impact of passing a port 0 to all these different plugins...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant