Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including @runnable/hostname with all npm packages installed. Try it out:

var hostname = require("@runnable/hostname")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

@runnable/hostname v3.0.0

generate a runnable elastic or direct hostname from parts

runnable-hostname

Build Status

util for generating an instance's elastic or direct hostname

Usage

var hostname = require('runnable-hostname');

// Non-master Pod Instance

hostname.direct({
  shortHash: 'abcdef',
  // non-masterPod instance has branch in name, so branch is required
  instanceName: 'branch-instanceName',
  branch: 'branch',
  ownerUsername: 'ownerUsername',
  masterPod: false,
  userContentDomain: 'runnableapp.com'
});
// abcdef-instanceName-staging-ownerUsername.runnableapp.com
hostname.elastic({
  shortHash: 'abcdef',
  instanceName: 'branch-instanceName',
  branch: 'branch',
  ownerUsername: 'ownerUsername',
  masterPod: false,
  userContentDomain: 'runnableapp.com'
});
// instanceName-staging-ownerUsername.runnableapp.com

// Master Pod Instance

hostname.direct({
  shortHash: 'abcdef',
  // masterPod instance has does NOT have branch in name, so branch is not required
  instanceName: 'instanceName',
  ownerUsername: 'ownerUsername',
  masterPod: true,
  userContentDomain: 'runnableapp.com'
});
// abcdef-instanceName-staging-ownerUsername.runnableapp.com
hostname.elastic({
  shortHash: 'abcdef',
  instanceName: 'instanceName',
  ownerUsername: 'ownerUsername',
  masterPod: true,
  userContentDomain: 'runnableapp.com'
});
// instanceName-staging-ownerUsername.runnableapp.com

// Isolated Master Instance

hostname.direct({
  shortHash: 'abcdef',
  branch: 'branch',
  instanceName: 'branch-instanceName',
  ownerUsername: 'ownerUsername',
  masterPod: false,
  isolated: 'asd76sdasg2341324',
  isIsolationGroupMaster: true,
  userContentDomain: 'runnableapp.com'
});
// abcdef-instanceName-staging-ownerUsername.runnableapp.com
hostname.elastic({
  shortHash: 'abcdef',
  branch: 'branch',
  instanceName: 'branch-instanceName',
  ownerUsername: 'ownerUsername',
  masterPod: false,
  isolated: 'asd76sdasg2341324',
  isIsolationGroupMaster: true,
  userContentDomain: 'runnableapp.com'
});
// instanceName-staging-ownerUsername.runnableapp.com           

// Isolated Container (not master) Instance
Master instance shortHash = '343gh1'

hostname.direct({
  shortHash: 'abcdef',
  branch: 'branch',
  instanceName: 'branch-instanceName',
  ownerUsername: 'ownerUsername',
  masterPod: false,
  isolated: 'asd76sdasg2341324',
  isIsolationGroupMaster: true,
  userContentDomain: 'runnableapp.com'
});
// 343gh1--instanceName-staging-ownerUsername.runnableapp.com
hostname.elastic({
  shortHash: 'abcdef',
  branch: 'branch',
  instanceName: 'branch-instanceName',
  ownerUsername: 'ownerUsername',
  masterPod: false,
  isolated: 'asd76sdasg2341324',
  isIsolationGroupMaster: true,
  userContentDomain: 'runnableapp.com'
});
// instanceName-staging-ownerUsername.runnableapp.com

// Non-repo
hostname.direct({
  shortHash: 'abcdef',
  instanceName: 'instanceName',
  ownerUsername: 'ownerUsername',
  masterPod: false,
  isolated: 'asd76sdasg2341324',
  isIsolationGroupMaster: true,
  userContentDomain: 'runnableapp.com'
});
// 343gh1--instanceName-staging-ownerUsername.runnableapp.com
hostname.elastic({
  shortHash: 'abcdef',
  instanceName: 'instanceName',
  ownerUsername: 'ownerUsername',
  masterPod: false,
  isolated: 'asd76sdasg2341324',
  isIsolationGroupMaster: true,
  userContentDomain: 'runnableapp.com'
});
// instanceName-staging-ownerUsername.runnableapp.com
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free