Search…
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

1
import env from 'env'
Copied!

Provision

Provision using a provisioning token
1
const token = '[Request token from Admin]'
2
3
return env.provision({
4
org: {
5
code: 'env_code',
6
name: 'env_name',
7
ttl: 10000
8
},
9
account: {
10
11
name: {
12
first: 'Valid',
13
last: 'Example'
14
}
15
}
16
}, { token })
Copied!

Admin

Provision (admins may provision ephemeral environments without a token)
1
return env.provision({
2
org: {
3
code: 'env_code',
4
name: 'env_name',
5
ttl: 10000
6
},
7
account: {
8
9
name: {
10
first: 'Valid',
11
last: 'Example'
12
}
13
}
14
})
Copied!

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

1
return env.teardown('env_code')
Copied!

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.
1
return env.createProvisioningToken('apiKey', 'c_name_of_service_account')
Copied!

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
1
mdctl env import --env [environment_name]
Copied!
Export ephemeral environment
1
mdctl env export --env [environment_name]
Copied!
Last modified 9mo ago