Offline Mode
Once a Quonfig SDK has loaded your configuration, your servers keep evaluating feature flags and config from memory, even if, despite our intense efforts, our servers are down. (A process that is starting up while it can't reach us is a different case, with its own setting; see If Quonfig Is Unreachable at Startup.) As a developer, you should also be able to run your app and test your code without a reliable internet connection. That's what offline mode is for.
Using Quonfig offline
Offline mode runs the SDK from a local copy of your workspace (a datadir) instead of the Quonfig servers. Pull it once with qfg pull --dir ./my-config; it holds your complete ruleset, for every environment, as of the pull.
Backend SDKs
Point the SDK at the directory and choose an environment, for example QUONFIG_DIR=./my-config QUONFIG_ENVIRONMENT=development rails server with the Ruby SDK. Datadir mode loads synchronously from disk, so the startup-failure setting does not apply to it. Local Workspace (datadir) covers keeping the copy current, which environment names are valid, and what the SDK still sends over the network when an SDK key is set; Open Source / Fully Local has each SDK's setup, including auto-reload on file changes.
Frontend SDKs
Browser and React Native SDKs can't read files from disk. Use qfg serve to serve the datadir over HTTP:
qfg serve --datadir ./my-config --environment development
# qfg serve listening on http://127.0.0.1:6580
Then point the SDK's apiUrls at it. qfg serve doesn't accept telemetry, so turn telemetry off:
- JavaScript
- React
import { quonfig } from "@quonfig/javascript";
await quonfig.init({
sdkKey: "PUBLIC_FRONTEND_KEY", // any string works unless qfg serve has --frontend-sdk-key
context: { user: { key: "alice@example.com" } },
apiUrls: ["http://localhost:6580"],
collectEvaluationSummaries: false,
});
import { QuonfigProvider } from "@quonfig/react";
<QuonfigProvider
sdkKey="PUBLIC_FRONTEND_KEY"
contextAttributes={{ user: { key: "alice@example.com" } }}
apiUrls={["http://localhost:6580"]}
collectEvaluationSummaries={false}
>
<App />
</QuonfigProvider>;
If you run qfg serve on a server (in a Docker image, for example), use that server's URL in apiUrls instead. The qfg serve guide covers authentication, watching for changes, and what it doesn't support.