Local-only, offline mode

You can disable server initialization and use a build-time fallback snapshot of your flag logic to use SDKs in local-only, offline mode. This is useful for running unit tests or using Hypertune in isolated, secure, air-gapped environments.

Set the initDataProvider option to null in your createSource options. You can also set remoteLogging.mode to off to disable sending logs to the remote server:

src/lib/getHypertune.ts
import { createSource } from "../generated/hypertune";

const hypertuneSource = createSource({
  token: process.env.HYPERTUNE_TOKEN!,
  initDataProvider: null,
  remoteLogging: { mode: "off" },
});

export default async function getHypertune() {
  return hypertuneSource.root({
    args: {
      context: {
        environment:
          process.env.NODE_ENV === "development"
            ? "development"
            : "production",
        user: { id: "1", name: "Test", email: "hi@test.com" },
      },
    },
  });
}

Last updated