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 Setupを使用してプラグインをインストールできます。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 Env.getKey({ key: 'API_URL' });console.log(result.value); // 'https://api.example.com'真実の源
「真実の源」このページはプラグインの src/definitions.ts公開されたAPIがアップストリームで変更されたときは、再度Syncを実行してください。
Getting Startedから続けてください
「Getting Startedから続けてください」あなたが Getting Started を使用してダッシュボードとAPIの作業を計画している場合、 Using @capgo/capacitor-env Using @capgo/capacitor-env APIの概要 APIの実装詳細についての概要 導入 __CAPGO_KEEP_0__のキー APIのキー、 API キーの実装詳細について Devices __CAPGO_KEEP_0__の実装詳細についてのデバイス