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.
インストール
「インストール」のセクションCapgoのAIアシストセットアップを使用してプラグインをインストールできます。AIツールにCapgoスキルを追加するには、以下のコマンドを実行してください。
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-pluginsThen use the following prompt:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-env` plugin in my project.If you prefer Manual Setup, install the plugin by running the following commands and follow the platform-specific instructions below:
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 がアップストリームで変更された場合に、再度 Sync を実行してください。
Getting Started から続けてください
「Getting Started から続けてください」というセクションCapacitor を使用している場合 Getting Started ダッシュボードと API の操作を計画するには、 @capgo/capacitor-env を使用 native capabilityの使用に@capgo/capacitor-envを使用します。 APIの概要 APIの実装詳細について 導入 導入の実装詳細について APIのキー APIのキーに関する実装詳細 デバイス デバイスの実装詳細