Local-only, offline mode
To use SDKs in local-only, offline mode, disable server initialization and use a build-time snapshot of your flag logic. 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:
import { HypertuneProvider } from '../generated/hypertune.react'
export default function AppHypertuneProvider({
children,
}: {
children: React.ReactNode
}) {
return (
<HypertuneProvider
createSourceOptions={{
token: import.meta.env.VITE_HYPERTUNE_TOKEN!,
initDataProvider: null,
remoteLogging: { mode: 'off' },
}}
rootArgs={{
context: {
environment:
process.env.NODE_ENV === 'development'
? 'development'
: 'production',
user: {
id: 'e23cc9a8-0287-40aa-8500-6802df91e56a',
name: 'Example User',
email: '[email protected]',
},
},
}}
>
{children}
</HypertuneProvider>
)
}
Last updated