Environments

Ephemeral Environments

Ephemeral environments enable the creation of temporary environments to assist development and testing. They can be created from a script and can be imported and exported using the mdctl tool.

Usage

import env from 'env'

Provision

Provision using a provisioning token

const token = '[Request token from Admin]'

return env.provision({
  org: {
    code: 'env_code',
    name: 'env_name',
    ttl: 10000
  },
  account: {
    email: 'valid@example.com',
    name: {
      first: 'Valid',
      last: 'Example'
    }
  }
}, { token })

Admin

Provision (admins may provision ephemeral environments without a token)

return env.provision({
  org: {
    code: 'env_code',
    name: 'env_name',
    ttl: 10000
  },
  account: {
    email: 'valid@example.com',
    name: {
      first: 'Valid',
      last: 'Example'
    }
  }
})

provision(data, options)

Arguments

  • data { Object }

    • org { Object } [Optional]

      • code { String } Environment code.

      • name { String } Environment Name.

      • ttl { Number } Time to live, will be removed after.

      • validateOrgCode { Boolean }

      • maxApps { Number } Defaults to 10.

      • minPasswordScore { Number }

      • requireMobile { Boolean }

    • account { Object }

      • email { String } [Required] Account email

      • name { Object }

        • first { String }

        • last { String }

      • password { String } [Optional]

  • options { Object }

    • token { String } Access token

Teardown

return env.teardown('env_code')

teardown(code, options)

Arguments

  • code { String } Environment code.

  • options { Object }

    • token { String } Access token

Generate provision token

Service account must have admin role. And createProvisioningToken needs to be executed from base org.

return env.createProvisioningToken('apiKey', 'c_name_of_service_account')

createProvisioningToken(apiKey, serviceAccountName, options)

Arguments

  • apiKey { String } Application key or name.

  • serviceAccountName { String } Name of an admin service account.

  • options { Object } [Optional]

    • skipAcl { Boolean }

    • bypassCreateAcl { Boolean }

    • grant { Number }

    • permanent { Boolean }

    • activatesIn { Date }

    • validAt { Date }

    • expiresIn { Date }

    • isSupportLogin { Boolean }

    • maxUses { Number }

Import/Export

Import ephemeral environment

mdctl env import --env [environment_name]

Export ephemeral environment

mdctl env export --env [environment_name]

Last updated