Skip to content

Capacitor plugin to store and read env var in capacitor config, helpfull for multitenant app.

License

Notifications You must be signed in to change notification settings

Cap-go/capacitor-env

@capgo/capacitor-env

Capgo - Instant updates for capacitor

Set Env var in Capacitor config and read them at runtime, This plugin is helpful for multitenant app or white label, when you want to keep the same code but some config have to differ.

Documentation

The most complete doc is available here: https://capgo.app/docs/plugins/env/

Install

npm install @capgo/capacitor-env
npx cap sync

API

Capacitor plugin for accessing environment variables in native code.

This plugin provides a secure way to access environment variables that were compiled into the native application at build time. Environment variables can be configured during the build process and accessed at runtime without exposing them in the web bundle.

getKey(...)

getKey(options: { key: string; }) => Promise<{ value: string; }>

Retrieves the value of a specific environment variable by key.

This method fetches environment variables that were set during the native build process. The variables must be configured in the native project before they can be accessed at runtime.

Param Type Description
options { key: string; } - Configuration object containing the environment variable key

Returns: Promise<{ value: string; }>


getPluginVersion()

getPluginVersion() => Promise<{ version: string; }>

Get the version of the native Capacitor plugin.

This method returns the current version of the capacitor-env plugin that is installed in the native application. Useful for debugging and ensuring compatibility between the web and native components.

Returns: Promise<{ version: string; }>


About

Capacitor plugin to store and read env var in capacitor config, helpfull for multitenant app.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •