Getting Started
このプラグインのインストール手順とフルマークダウンガイドを含むセットアッププロンプトをコピーします。
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.
インストール
「インストール」のセクションAI-Assisted セットアップを使用してプラグインをインストールできます。AI ツールに Capgo スキルを追加するには、以下のコマンドを実行してください。
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins次に、以下のプロンプトを使用してください:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-env` plugin in my project.Manual Setup を好む場合は、以下のコマンドを実行してプラグインをインストールし、以下のプラットフォーム固有の指示に従ってください:
bun add @capgo/capacitor-envbunx cap syncImport
「Import」セクションimport { Env } from '@capgo/capacitor-env';API の概要
「API の概要」セクションgetKey
「getKey」セクション特定キーの環境変数の値を取得します。
このメソッドは、ネイティブのビルドプロセス中に設定された環境変数を取得します。変数は、実行時にはネイティブプロジェクトで構成する必要があります。
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 がアップストリームで変更された場合に、再度同期を実行してください。
Getting Started から続けて
「Getting Started から続けて」というセクションCapacitor を使用している場合 Getting Started ダッシュボードと API の計画と操作を行う場合、接続してください。 Using @capgo/capacitor-env for the native capability in Using @capgo/capacitor-env API Overview for the implementation detail in API Overview Introduction for the implementation detail in Introduction API Keys for the implementation detail in API Keys, and Devices for the implementation detail in Devices.