はじめに
このプラグインのインストール手順と全マークダウンガイドを含む設定の質問をコピーしてください。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-env`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/env/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
インストール
「インストール」のセクションbun add @capgo/capacitor-envbunx cap syncインポート
「インポート」のセクションimport { Env } from '@capgo/capacitor-env';API オーバービュー
Section titled “API Overview”getKey
Section titled “キーを取得”特定の環境変数の値をキーで取得します。
このメソッドは、ネイティブのビルドプロセス中に設定された環境変数を取得します。変数は、実行時にはネイティブプロジェクトで構成する必要があります。
import { Env } from '@capgo/capacitor-env';
const result = await EnvPlugin.getKey({ key: 'API_URL' });console.log(result.value); // 'https://api.example.com'このページはプラグインの src/definitions.ts. 公開用のAPIがアップストリームで変更された場合に再度Syncを実行してください。