Configuration and authentication
Configuration in every client is one object holding, in practice, one value: your API key. There is no SDK-side account setting, no region and no environment switch.
The key is the configuration
Each generated client calls the field something slightly different but means
the same thing: a bearer token sent as Authorization: Bearer <key>.
| Language | Where it goes |
|---|---|
| TypeScript | new Configuration({ accessToken }) |
| Python | lockally.Configuration(access_token=...) |
| Ruby | `Lockally.configure { |
| PHP | Configuration::getDefaultConfiguration()->setAccessToken(...) |
| Go | on the context, lockally.ContextAccessToken |
Go is the odd one out: the key travels per call on context.Context, not on
the configuration object. That is the Go generator’s convention.
Switching between live and test
There is no environment setting. You change the key.
A key beginning lk_test_ runs the whole path without delivering mail or
drawing on your allowance; lk_live_ is real. Both use the same base URL, so
the client is configured identically and only the secret differs.
new Configuration({ accessToken: process.env.LOCKALLY_API_KEY })
That means your code does not know which environment it is in, which is
usually what you want and occasionally a hazard. A one-line assertion in
staging that the key starts lk_test_ is worth adding. See
Live and test keys.
Base URL
Defaults to https://api.lockally.com. Every client lets you override it, and
there is almost no reason to: there is no staging host and no regional
endpoint. The override exists for pointing at a local proxy or a recording
proxy in tests.
Timeouts
The generated clients use your language’s default HTTP timeout, which in several cases means no timeout at all. That is worth overriding.
Sends are accepted quickly, because delivery is asynchronous, so a long timeout buys nothing and a hung connection blocks a worker. Something in the range of 10 to 30 seconds is sensible, set on the HTTP client your language’s constructor accepts.
What configuration will not give you
No retry policy, no backoff, no rate-limit handling. Those are not settings you have forgotten to find: they are not in the clients at all.