luna fork
Copy a luna, as it is now or as it was at an earlier moment, to a new key or another environment.
luna fork makes a new luna that starts from another luna’s data, as it is now or as it was at an earlier moment.
luna fork List --key '{"id":"groceries"}' --to-key '{"id":"groceries-copy"}'
Reference
luna fork [OPTIONS] --key <KEY> <LUNA_TYPE>
| Option | Type | Default | Does |
|---|---|---|---|
<LUNA_TYPE> |
text | Required | The luna’s type. |
--key <KEY> |
JSON | Required | The key of the luna to copy, such as '{"id":"a"}'. |
--to-key <TO_KEY> |
JSON | The same key | The new luna’s key. Leave it out only with --to-env. |
--to-env <TO_ENV> |
text | The same environment | Copies into this environment of the project. |
--at <AT> |
moment | Now | Copies the luna as it was at this moment. |
--schedules |
flag | Off | Keeps the luna’s schedules in the copy. Without it, the copy starts with none. |
--dir <DIR> |
path | . |
The app’s folder. Its env file names the project and environment. |
--env <ENV> |
text | LUNA_ENV, then production |
The environment the luna is in. |
--project <PROJECT> |
text | LUNA_PROJECT |
The project, by name or as organisation/project. |
--tenant <TENANT> |
text | The environment’s own | A tenant added to the environment, by name. |
--token <TOKEN> |
text | LUNA_TOKEN, then your login |
An API token or account key to act with. |
Good to know
- Give
--to-key,--to-envor both. The CLI refuses a fork with neither. - When the luna type has sandboxes, the copy gets them as they were last saved. If they cannot be copied, the luna is forked all the same and the CLI says why.
- Reading the source needs
data:readon its environment, and writing the copy needsdata:writeon the one it goes to.
Examples
Copy a luna to a new key
luna fork List --key '{"id":"groceries"}' --to-key '{"id":"groceries-copy"}'
Copy a production luna into your own environment
luna fork List --key '{"id":"groceries"}' --env production --to-env dev-ann
Copy a luna as it was an hour ago
luna fork List --key '{"id":"groceries"}' --to-key '{"id":"groceries-1h"}' --at "1h ago"