Development and production
Most providers give you two of something: two hosts, two dashboards, two projects. Lockally gives you two kinds of key against one everything else.
| Base URL | https://api.lockally.com, for both |
| Separation | the key prefix, lk_live_ or lk_test_ |
| Accounts | one workspace holds both kinds of key |
| Data | one database, test rows flagged and excluded from every count |
There is no staging host, no environment parameter and no second workspace to
create. Swapping the key is the entire change between development and
production, which is the point: the code path you exercise in development is
the one that runs in production, including validation, grants, suppression,
DLP, threading and webhooks.
Live and test keys has the full behaviour. This page is about how to arrange your own project around it.
What this gets right
No drift. A separate sandbox implementation is a second codebase that slowly stops matching the first. There is nothing here to drift: a test send runs the real handler and diverts at the last step, after everything that could reject it has already run.
No second account to keep in step. Your domains, templates, webhooks, suppression list and plan are the same objects in both modes, so a template you tested against is the template you send with.
What this costs you, and it is real
Your test data lives next to your production data. Test messages are rows
in the same tables, marked test and excluded from counts, rate limits,
allowance, warm-up and reputation. They are not in a separate place you can
drop wholesale.
A mistake with a key prefix is a real send. There is no host to get wrong
as a safety net. If your configuration loads lk_live_ in a test run, the mail
goes out. Keep the two in separate environment variables with distinct names,
rather than one LOCKALLY_API_KEY whose value changes per environment, so a
missing variable fails loudly instead of falling back to the wrong one.
One workspace means one plan. The event log needs Starter or above, so on Free your integration can send with a test key but cannot read the event log back.
Arranging your own environments
The separation you need is in your configuration, not ours:
- Local and CI load
LOCKALLY_TEST_KEY. Nothing else is defined, so a code path that tries to send live fails on a missing variable. - Staging loads a test key too, unless you specifically need mail to arrive somewhere, in which case use a live key and a domain you own.
- Production loads
LOCKALLY_LIVE_KEY, and the deployment refuses to start without it.
Give each key a label that says where it runs (ci, staging, prod-api), so
the key list is readable and revoking one is an obvious decision rather than a
guess. See Creating and managing keys.
A test key no longer needs a verified domain
A test key removes delivery AND the sender check that exists to protect delivery. A send from a domain you have not verified is accepted, and the response says so:
{
"status": "delivered",
"message_id": "<...@test.lockally.com>",
"warning": "Accepted because this is a test key. A live key would refuse
this send: ... Verify yourdomain.com before going live."
}
This changed because the gate ran before the test-mode divert, so 23 of the 27 api-mode workspaces on the platform, every one without a verified domain, could not make a single test call. “Try it before you touch DNS” was not actually possible.
A live key is unchanged. It still requires a verified domain in api mode,
or a mailbox or alias on one in business and both modes, and still answers
403. The proof that DKIM signs and SPF authorises matters exactly as much as
it did; it just has nothing to protect on a send that never leaves the
platform.