Tutorial Tutorial Tutorial Developer Platform Developer Platform Developer Platform ~24 phút ~24 min ~24 នាទី Đồng bộ 2026-06-10 Synced 2026-06-10 ធ្វើសមកាល 2026-06-10

Workers Tích hợp Workers integration Workers ការរួមបញ្ចូល

Hướng dẫn chi tiết đồng bộ từ docs Cloudflare — mỗi section có backlink tới đúng vị trí trên trang gốc. Detailed guide synced from Cloudflare docs — each section links to the matching anchor on the official page. មគ្គុទ្ទេសក៍លម្អិតធ្វើសមកាលពី docs Cloudflare — ផ្នែកនីមួយៗមានតំណទៅទីតាំងត្រូវគ្នានៅទំព័រផ្លូវការ។

← Danh mục ← Catalog ← បញ្ជី

Giải thích nhanh Quick context បរិបទរហ័ស

Thuộc Developer Platform — thực hành triển khai code, API và dữ liệu trên edge/serverless. Tutorial «Workers integration» giúp bạn làm quen luồng triển khai thật — phù hợp đọc trước khi mở tài liệu gốc tiếng Anh. Docs gốc chia khoảng 3 bước chính; bản tóm tắt dưới đây giúp bạn nắm khung trước khi làm theo từng lệnh.

Cloudflare Secrets Store is a secure, centralized location in which account-level secrets are stored and managed. The secrets are securely encrypted and stored across all Cloudflare data centers.

Cloudflare Secrets Store គឺជាកន្លែងដែលមានសុវត្ថិភាពនិងមានមូលដ្ឋានដែលទិន្នន័យទិន្នន័យទិន្នន័យទិន្នន័យទិន្នន័យទិន្នន័យទិន្នន័យទិន្នន័យទិន្នន័យទិន្នន័យទិន្នន័យ។ ទិន្នន័យទាំងនេះត្រូវបានកាត់បន្ថយដោយសុវត្ថិភាពនិងត្រូវបានរក្សាទុកតាមរយៈមជ្ឈមណ្ឌលទិន្នន័យទាំងអស់ Cloudflare ។

Lưu ý Note ចំណាំ

Lưu ý trước khi làm Notes before you start ចំណាំមុនពេលចាប់ផ្តើម

  • Đây là bản tóm tắt trên Orange Cloud Learning Hub — không thay thế tài liệu chính thức.
  • Luôn mở liên kết «Tài liệu gốc» bên dưới khi cần lệnh CLI, snippet code và ảnh minh họa đầy đủ.
  • Cần tài khoản Cloudflare, Wrangler CLI và (thường) hoàn thành hướng dẫn Get started của Workers/Pages.
  • Docs Cloudflare cập nhật thường xuyên — đối chiếu ngày «Rà soát lần cuối» trên trang gốc khi triển khai production.
  • This is a summary on Orange Cloud Learning Hub — it does not replace the official documentation.
  • Open the Official docs link below for CLI commands, code snippets, and full screenshots.
  • Requires a Cloudflare account, Wrangler CLI, and (typically) completing the Workers/Pages Get started guide.
  • Cloudflare docs change frequently — verify the Last reviewed date on the official page before production use.
  • នេះគឺជាការបញ្ជាក់អំពី Orange Cloud Learning Hub — វាគឺជាការផ្លាស់ប្តូរនៃឯកសារផ្លូវការ។
  • ចុចតំណភ្ជាប់ Docs Official នៅខាងក្រោមសម្រាប់ការបញ្ជា CLI, សៀវភៅកូដនិងរូបថតពេញលេញ។
  • តម្រូវឱ្យមានគណនី Cloudflare, Wrangler CLI និង (ប្រហែលជា) ការបញ្ចប់គណនី Workers/Pages Get started ។
  • Cloudflare បានផ្លាស់ប្តូរជាធម្មតានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅ។

Overview Overview Overview

Phần «Tổng quan» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.

Read the "Overview" section below — open the official docs link for full screenshots and configuration tabs.

អានផ្នែក «Overview» ខាងក្រោម — បើកតំណ docs ផ្លូវការសម្រាប់រូបភាព និង tab កំណត់។

Mở section docs gốc ↗ Open source section ↗ បើកផ្នែក docs ផ្លូវការ ↗
Cloudflare Secrets Store là một vị trí an toàn, tập trung, nơi bí mật cấp tài khoản được lưu trữ và quản lý. Các bí mật được mã hóa an toàn và lưu trữ trên tất cả các trung tâm dữ liệu Cloudflare.
Cloudflare Secrets Store is a secure, centralized location in which account-level secrets are stored and managed. The secrets are securely encrypted and stored across all Cloudflare data centers.
Cloudflare Secrets Store គឺជាកន្លែងដែលមានសុវត្ថិភាពនិងមានមូលដ្ឋានដែលទិន្នន័យទិន្នន័យទិន្នន័យទិន្នន័យទិន្នន័យទិន្នន័យទិន្នន័យទិន្នន័យទិន្នន័យទិន្នន័យទិន្នន័យទិន្នន័យទិន្នន័យ។ ទិន្នន័យទាំងនេះត្រូវបានកាត់បន្ថយដោយសុវត្ថិភាពនិងត្រូវបានរក្សាទុកតាមរយៈមជ្ឈមណ្ឌលទិន្នន័យទាំងអស់ Cloudflare ។
Hãy xem xét các bước dưới đây để tìm hiểu cách sử dụng giá trị từ tài khoản bí mật lưu trữ của bạn với Cloudflare Workers.
Consider the steps below to learn how to use values from your account secrets store with Cloudflare Workers.
សូមពិនិត្យមើលដំណោះស្រាយខាងក្រោមដើម្បីរៀនអំពីរបៀបដើម្បីប្រើសម្រាប់ការប្រើសម្រាប់តម្លៃពីការប្រើសម្រាប់គណនីរបស់អ្នកជាមួយ Cloudflare Workers ។
Điều này khác với Workers Variables and Secrets, nơi bạn xác định và quản lý bí mật của mình ở cấp độ mỗi công nhân.
This is different from Workers Variables and Secrets, where you define and manage your secrets on a per-Worker level.
នេះគឺជាការផ្សេងគ្នានៃ Workers Variables and Secrets, នៅពេលដែលអ្នកកំណត់និងគ្រប់គ្រងសិទ្ធិរបស់អ្នកនៅលើកម្រិតបុគ្គលិក។

Liên kết liên quan (docs Cloudflare) Related links (Cloudflare docs) តំណពាក់ព័ន្ធ (docs Cloudflare)

Trước khi bạn bắt đầu Before you begin មុនពេលដែលអ្នកចាប់ផ្តើម

Phần «Before you begin» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.

Read the "Before you begin" section below — open the official docs link for full screenshots and configuration tabs.

អានផ្នែក «មុនពេលដែលអ្នកចាប់ផ្តើម» ខាងក្រោម — បើកតំណ docs ផ្លូវការសម្រាប់រូបភាព និង tab កំណត់។

Mở section docs gốc ↗ Open source section ↗ បើកផ្នែក docs ផ្លូវការ ↗
  • Nếu using the Dashboard, hãy đảm bảo bạn đã có ứng dụng Workers. Hãy tham khảo Workers get started để hướng dẫn.
  • Bạn cũng nên có một cửa hàng được tạo dưới tab Secrets Store trên bảng điều khiển. Cửa hàng đầu tiên trong tài khoản của bạn được tạo tự động khi người dùng có Super Administrator or Secrets Store Admin role tương tác với nó.
  • ប្រសិនបើ using the Dashboard, សូមបញ្ជាក់ថាអ្នកមានកម្មវិធី Workers ។ សូមពិនិត្យមើល Workers get started សម្រាប់សំណួរ។
  • អ្នកគួរតែបង្កើតអតិថិជននៅក្រោមប្រភេទ Secrets Store នៅលើ Dashboard ។ ទិញដំបូងនៅក្នុងគណនីរបស់អ្នកត្រូវបានបង្កើតដោយស្វ័យប្រវត្តិនៅពេលដែលអ្នកប្រើដែលមាន Super Administrator or Secrets Store Admin role អនុវត្តជាមួយគណនីនេះ។
* Nếu không có cửa hàng nào tồn tại trong tài khoản của bạn và bạn có quyền cần thiết, bạn có thể sử dụng Wrangler command secrets-store store create <name> --remote để tạo cửa hàng đầu tiên của mình.
* If no store exists in your account yet and you have the necessary permissions, you can use the Wrangler command secrets-store store create <name> --remote to create your first store.
* ប្រសិនបើប្រព័ន្ធផ្សព្វផ្សាយអ៊ីនធឺណិតរបស់អ្នកមិនមានប្រព័ន្ធផ្សព្វផ្សាយអ៊ីនធឺណិតទេហើយអ្នកអាចប្រើ Wrangler command secrets-store store create <name> --remote ដើម្បីបង្កើតប្រព័ន្ធផ្សព្វផ្សាយអ៊ីនធឺណិតរបស់អ្នក។
Phong cách phát triển địa phương
Local development mode
លក្ខខណ្ឌនៃការអភិវឌ្ឍ lokal
Hướng dẫn này giả định bạn đang làm việc trong sản xuất. Để sử dụng Secrets Store cục bộ, bạn phải sử dụng secrets-store secret Wrangler commands mà không có lá cờ --remote.
This guide assumes you are working in production. To use Secrets Store locally, you must use secrets-store secret Wrangler commands without the --remote flag.
This guide assumes you are working in production. To use Secrets Store locally, you must use secrets-store secret Wrangler commands without the --remote flag.

Liên kết liên quan (docs Cloudflare) Related links (Cloudflare docs) តំណពាក់ព័ន្ធ (docs Cloudflare)

1.Điều Tạo bí mật tài khoản trong Secrets Store 1. Set up account secrets in Secrets Store 1 ។ ទាញយកប្រព័ន្ធប្រតិបត្តិការ Secrets Store

Phần «Thiết lập account secrets in Secrets Store» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.

Read the "1. Set up account secrets in Secrets Store" section below — open the official docs link for full screenshots and configuration tabs.

អានផ្នែក «1 ។ ទាញយកប្រព័ន្ធប្រតិបត្តិការ Secrets Store» ខាងក្រោម — បើកតំណ docs ផ្លូវការសម្រាប់រូបភាព និង tab កំណត់។

Mở section docs gốc ↗ Open source section ↗ បើកផ្នែក docs ផ្លូវការ ↗
Thực hiện theo các bước dưới đây để tạo ra bí mật. Bạn phải có Super Administrator or a Secrets Store Admin role trong tài khoản Cloudflare của mình.
Follow the steps below to create secrets. You must have a Super Administrator or a Secrets Store Admin role within your Cloudflare account.
សូមអនុវត្តតាមដំណោះស្រាយខាងក្រោមដើម្បីបង្កើតទិន្នន័យ។ អ្នកគួរតែមាន Super Administrator or a Secrets Store Admin role នៅក្នុងគណនីរបស់អ្នក Cloudflare ។
Bạn cũng có thể thêm bí mật tài khoản trực tiếp từ cài đặt Workers trên bảng điều khiển. Bạn có thể bỏ qua step 2 để làm điều đó.
You may also add account secrets directly from the Workers settings on the dashboard. You can skip to step 2 to do that.
អ្នកក៏អាចបន្ថែមសញ្ញាបនប័ត្រគណនីដោយផ្ទាល់ពីការកំណត់ Workers នៅលើប្រព័ន្ធប្រតិបត្តិការ។ អ្នកអាចហៅទៅ step 2 ដើម្បីធ្វើដូច្នេះ។
Sử dụng Wrangler command secrets-store secret create
Use the Wrangler command secrets-store secret create.
សូមប្រើ Wrangler command secrets-store secret create ។
Để sử dụng ví dụ sau đây, thay thế ID cửa hàng và tên bí mật bằng dữ liệu thực tế của bạn. Bạn có thể tìm và sao chép ID cửa hàng từ Secrets Store tab ↗ trên bảng điều khiển hoặc sử dụng wrangler secrets-store store list.
To use the following example, replace the store ID and secret name by your actual data. You can find and copy the store ID from the Secrets Store tab ↗ on the dashboard or use wrangler secrets-store store list.
ដើម្បីប្រើឧទាហរណ៍ខាងក្រោមនេះ, ការផ្លាស់ប្តូរ ID Store និងឈ្មោះ secret ដោយទិន្នន័យពិតប្រាកដរបស់អ្នក។ អ្នកអាចរកឃើញនិងចម្លង ID Store ពី Secrets Store tab ↗ នៅលើប្រព័ន្ធប្រតិបត្តិការឬប្រើ wrangler secrets-store store list ។
Lưu ý rằng một tên bí mật không thể chứa khoảng trống.
Note that a secret name cannot contain spaces.
សូមអរគុណថាឈ្មោះសុវត្ថិភាពមិនអាចមានពន្លឺ។
Cửa sổ Terminal
Terminal window
បង្វិល Terminal
text
npx wrangler secrets-store secret create <STORE_ID> --name MY_SECRET_NAME --scopes workers --remote
text
✓ Enter a secret value: › ***


🔐 Creating secret... (Name: MY_SECRET_NAME, Value: REDACTED, Scopes: workers, Comment: undefined)

✓ Select an account: › My account

✅ Created secret! (ID: 13bc7498c6374a4e9d13be091c3c65f1)
  1. Trong bảng điều khiển Cloudflare, đi đến trang Secrets Store.
  1. In the Cloudflare dashboard, go to the Secrets Store page.
  1. ក្នុងប្រព័ន្ធប្រតិបត្តិការ Cloudflare សូមចូលទៅក្នុងទំព័រ Secrets Store ។
  1. Chọn Create secret
  2. Điền vào các trường cần thiết, chọn Workers làm Permission scope. Một khi bí mật được lưu, giá trị bí mật sẽ không còn có sẵn để xem.
  3. (Tùy chọn) Chọn Add additional secret để tạo nhiều hơn một bí mật cùng một lúc.
  4. Chọn Save để xác nhận.
  1. Select Create secret.
  2. Fill in the required fields, choosing Workers as the Permission scope. Once the secret is saved, the secret value will no longer be available for viewing.
  3. (Optional) Select Add additional secret to create more than one secret at a time.
  4. Select Save to confirm.
  1. សូមជ្រើស Create secret ។
  2. សូមបញ្ជាក់ពីរបៀបដែលអ្នកត្រូវការដើម្បីចុច Workers ដូចជា Permission scope ។ បន្ទាប់ពីការសរសេរប្រសិនបើប្រសិនបើប្រសិនបើប្រសិនបើប្រសិនបើប្រសិនបើប្រសិនបើប្រសិនបើប្រសិនបើប្រសិនបើប្រសិនបើប្រសិនបើប្រសិនបើប្រសិនបើប្រសិនបើប្រសិនបើប្រសិនបើប្រសិនបើប្រសិនបើប្រសិនបើប្រសិនបើប្រសិនបើប្រសិនបើប្រសិនបើប្រសិនបើប្រសិនបើប្រសិនបើប្រសិនបើប្រសិនបើប្រសិនបើប្រសិនបើប្រសិនបើប្រសិនបើប្រសិនបើ។
  3. (គោលបំណង) ជ្រើស Add additional secret ដើម្បីបង្កើតសាសនាច្រើនជាងមួយក្នុងមួយពេល។
  4. ចុច Save ដើម្បីបញ្ជាក់។
Bạn có thể tìm và sao chép ID cửa hàng từ Secrets Store tab ↗ trên bảng điều khiển hoặc sử dụng Wrangler command. Ngoài ra, hãy chắc chắn rằng bí mật name của bạn không chứa khoảng trống.
You can find and copy the store ID from the Secrets Store tab ↗ on the dashboard or use the Wrangler command. Also, make sure your secret name does not contain spaces.
អ្នកអាចរកឃើញនិងចម្លង ID Store ពី Secrets Store tab ↗ នៅលើប្រព័ន្ធប្រតិបត្តិការឬប្រើ Wrangler command ។ សូមប្រាកដថា name របស់អ្នកមិនមានបំណង។
Hãy tham khảo Secrets Store API cho tài liệu đầy đủ API.
Refer to Secrets Store API for the full API documentation.
សូមមើល Secrets Store API សម្រាប់ឯកសារពេញលេញ API ។
Yêu cầu quyền token API
Required API token permissions
តម្រូវការ API សមត្ថភាព token
Ít nhất một trong các token permissions sau đây là cần thiết:
At least one of the following token permissionsis required:
មានតម្រូវការមួយចំនួននៃ token permissions ដូចខាងក្រោម:
  • Secrets Store Write
  • Secrets Store Write
  • Secrets Store Write
Tạo ra bí mật
Create a secret
ការបង្កើតសុវត្ថិភាព
text
curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/secrets_store/stores/$STORE_ID/secrets" \

  --request POST \

  --header "X-Auth-Email: $CLOUDFLARE_EMAIL" \

  --header "X-Auth-Key: $CLOUDFLARE_API_KEY" \

  --json '[

    {

        "name": "<MY_SECRET_NAME>",

        "value": "<SECRET_VALUE>",

        "scopes": [

            "workers"

        ],

        "comment": ""

    },

    {

        "name": "<MY_SECRET_NAME_2>",

        "value": "<SECRET_VALUE>",

        "scopes": [

            "workers"

        ],

        "comment": ""

    }

  ]'
Xem manage account secrets để biết thêm các tùy chọn.
Refer to manage account secrets for further options.
សូមពិនិត្យមើល manage account secrets សម្រាប់ជម្រើសបន្ថែមទៀត។

Liên kết liên quan (docs Cloudflare) Related links (Cloudflare docs) តំណពាក់ព័ន្ធ (docs Cloudflare)

2.Đối với Liên kết một tài khoản bí mật với nhân viên của bạn 2. Bind an account secret to your Worker 2 ។ ការបកប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែ

Phần «Bind account secret vào Worker» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.

Read the "2. Bind an account secret to your Worker" section below — open the official docs link for full screenshots and configuration tabs.

អានផ្នែក «2 ។ ការបកប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែប្រែ» ខាងក្រោម — បើកតំណ docs ផ្លូវការសម្រាប់រូបភាព និង tab កំណត់។

Mở section docs gốc ↗ Open source section ↗ បើកផ្នែក docs ផ្លូវការ ↗
Bindings cho phép Nhân viên của bạn tương tác với các tài nguyên trên tài khoản Cloudflare của bạn.
Bindings allow your Worker to interact with resources on your Cloudflare account.
Bindings អនុញ្ញាតឱ្យបុគ្គលិករបស់អ្នកចូលរួមជាមួយសម្ភារៈនៅលើគណនីរបស់អ្នក Cloudflare ។
Để liên kết một bí mật tài khoản với Nhân viên của bạn, bạn phải có một trong các roles within your Cloudflare account sau:
To bind an account secret to your Worker, you must have one of the following roles within your Cloudflare account:
To bind an account secret to your Worker, you must have one of the following roles within your Cloudflare account:
  • Super quản trị viên
  • Bí mật Store Deployer
  • Super Administrator
  • Secrets Store Deployer
  • អ្នកគ្រប់គ្រងល្អ
  • អ្នកលក់លក់លក់លក់លក់

Liên kết liên quan (docs Cloudflare) Related links (Cloudflare docs) តំណពាក់ព័ន្ធ (docs Cloudflare)

Thông qua Wrangler Via Wrangler ដោយ Wrangler

Phần «Via Wrangler» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.

Read the "Via Wrangler" section below — open the official docs link for full screenshots and configuration tabs.

អានផ្នែក «ដោយ Wrangler» ខាងក្រោម — បើកតំណ docs ផ្លូវការសម្រាប់រូបភាព និង tab កំណត់។

Mở section docs gốc ↗ Open source section ↗ បើកផ្នែក docs ផ្លូវការ ↗
  1. Thêm một Secrets Store ràng buộc vào Wrangler configuration file của bạn:
  1. Add a Secrets Store binding to your Wrangler configuration file:
  1. Add a Secrets Store binding to your Wrangler configuration file: អានអានអានអានអានអានអានអានអានអានអានអានអានអានអានអានអានអានអានអានអានអានអានអានអានអានអានអានអានអានអានអាន
binding: một tên mô tả cho liên kết của bạn. Điều này sẽ được sử dụng trong ứng dụng Workers khi accessing your secret on the env object. store<em>id: ID Secrets Store tương ứng nơi bí mật tài khoản của bạn được tạo ra. * secret</em>name: tên bí mật duy nhất, được xác định khi bí mật tài khoản của bạn được tạo ra.
binding: a descriptive name for your binding. This will be used in the Workers application when accessing your secret on the env object. store<em>id: the corresponding Secrets Store ID where your account secret was created. * secret</em>name: the unique secret name, defined when your account secret was created.
binding: ឈ្មោះសៀវភៅសម្រាប់ការភ្ជាប់របស់អ្នក។ នេះនឹងត្រូវបានប្រើនៅក្នុងកម្មវិធី Workers នៅពេល accessing your secret on the env object ។ store<em>id: ID ទិន្នន័យទិន្នន័យទិន្នន័យទិន្នន័យទិន្នន័យទិន្នន័យទិន្នន័យទិន្នន័យទិន្នន័យទិន្នន័យទិន្នន័យទិន្នន័យ។ * secret</em>name: ឈ្មោះសម្គាល់តែមួយគត់ដែលបានកំណត់នៅពេលដែលគណនីសម្គាល់របស់អ្នកត្រូវបានបង្កើត។
JSONC
JSONC
JSONC
text
{

  "main": "./src/index.js",

  "secrets_store_secrets": [

    {

      "binding": "<BINDING_VARIABLE>",

      "store_id": "<STORE_ID>",

      "secret_name": "<MY_SECRET_NAME>"

    }

  ]

}
TOML
TOML
TOML
text
main = "./src/index.js"


[[secrets_store_secrets]]

binding = "<BINDING_VARIABLE>"

store_id = "<STORE_ID>"

secret_name = "<MY_SECRET_NAME>"

Liên kết liên quan (docs Cloudflare) Related links (Cloudflare docs) តំណពាក់ព័ន្ធ (docs Cloudflare)

Thông qua Dashboard Via Dashboard ដោយ Dashboard

Phần «Via Dashboard» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.

Read the "Via Dashboard" section below — open the official docs link for full screenshots and configuration tabs.

អានផ្នែក «ដោយ Dashboard» ខាងក្រោម — បើកតំណ docs ផ្លូវការសម្រាប់រូបភាព និង tab កំណត់។

Mở section docs gốc ↗ Open source section ↗ បើកផ្នែក docs ផ្លូវការ ↗
  1. Trong bảng điều khiển Cloudflare, đi đến Workers & Pages.
  1. In the Cloudflare dashboard, go to Workers & Pages.
  1. នៅលើប្រព័ន្ធប្រតិបត្តិការ Cloudflare សូមចូលទៅ Workers & Pages ។
  1. Chọn ứng dụng Workers.
  2. Go to Settings \> Bindings and select Add.
  3. Trên bảng bên Add a resource binding, chọn Secrets Store.
  4. Điền vào các trường cần thiết:
  1. Select a Workers application.
  2. Go to Settings \> Bindings and select Add.
  3. On the Add a resource binding side panel, choose Secrets Store.
  4. Fill in the required fields:
  1. ជ្រើសកម្មវិធី Workers ។
  2. ចុច Settings & > Bindings ហើយចុច Add ។
  3. នៅលើបណ្តាញខាងលិច Add a resource binding ចុច Secrets Store ។
  4. សូមបញ្ជាក់នៅក្នុងឧបករណ៍ដែលត្រូវការ:
Variable name: một tên cho liên kết. Điều này sẽ được sử dụng cho Công nhân của bạn để access bí mật (step 3 bên dưới). Secret name: chọn từ danh sách các bí mật tài khoản có sẵn được tạo trong step 1. * (Tùy chọn - Chỉ quản trị) Nếu bí mật bạn cần chưa tồn tại, hãy chọn Create secret. Điều này sẽ thêm bí mật cấp tài khoản theo cách tương tự như nếu bạn có created it on the Secrets Store.
Variable name: a name for the binding. This will be used for your Worker to access the secret (step 3 below). Secret name: select from the list of available account secrets created in step 1. * (Optional - Admins only) If the secret you need does not exist yet, select Create secret. This will add an account level secret in the same way as if you had created it on the Secrets Store.
Variable name: ឈ្មោះសម្រាប់ការភ្ជាប់។ នេះនឹងត្រូវបានប្រើសម្រាប់បុគ្គលិករបស់អ្នកទៅ access សៀវភៅ (step 3 នៅខាងក្រោម). Secret name: ជ្រើសពីសៀវភៅសៀវភៅគណនីដែលអាចរកបានដែលបានបង្កើតនៅក្នុង step 1 ។ * (គោលបំណង - Admins only) ប្រសិនបើគោលបំណងដែលអ្នកត្រូវតែមិនមានទេ, សូមជ្រើស Create secret ។ នេះនឹងបន្ថែមប្រសិនបើអ្នកមាន created it on the Secrets Store ដូចគ្នានេះ។
  1. Chọn Deploy để triển khai liên kết của bạn. Khi triển khai, có hai lựa chọn:
  1. Select Deploy to deploy your binding. When deploying, there are two options:
  1. ចុច Deploy ដើម្បីដំឡើងការភ្ជាប់របស់អ្នក។ នៅពេលការដំឡើងមានរយៈពេល ២ វិនាទី។
Deploy: Ngay lập tức triển khai liên kết đến 100% khán giả của bạn. Save version: Lưu một phiên bản của liên kết mà bạn có thể triển khai trong tương lai.
Deploy: Immediately deploy the binding to 100% of your audience. Save version: Save a version of the binding which you can deploy in the future.
Deploy: ទាញយកការបណ្តុះបណ្តុះបណ្តុះបណ្តុះបណ្តុះបណ្តុះបណ្តុះបណ្តុះបណ្តុះបណ្តុះបណ្តុះបណ្តុះបណ្តុះបណ្តុះបណ្តុះបណ្តុះបណ្តុះបណ្តុះបណ្តាល Save version: រក្សាទុកកំណែនៃការភ្ជាប់ដែលអ្នកអាចដំឡើងនៅក្នុងអនាគត។

Liên kết liên quan (docs Cloudflare) Related links (Cloudflare docs) តំណពាក់ព័ន្ធ (docs Cloudflare)

3 Cái Access bí mật trên đối tượng env 3. Access the secret on the env object 3 ។ Access សញ្ញាបនប័ត្រនៅលើ Object env

Phần «Access secret on env object» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.

Read the "3. Access the secret on the env object" section below — open the official docs link for full screenshots and configuration tabs.

អានផ្នែក «3 ។ Access សញ្ញាបនប័ត្រនៅលើ Object env» ខាងក្រោម — បើកតំណ docs ផ្លូវការសម្រាប់រូបភាព និង tab កំណត់។

Mở section docs gốc ↗ Open source section ↗ បើកផ្នែក docs ផ្លូវការ ↗
Bindings được đặt trên đối tượng env. Để access bí mật bạn trước tiên cần một cuộc gọi không đồng bộ.
Bindings are located on the env object. To access the secret you first need an asynchronous call.
Bindings មានទីតាំងស្ថិតនៅលើអobject env ។ ដើម្បី access ការសរសេរសុវត្ថិភាពអ្នកត្រូវការជាលើកដំបូងការសរសេរអាសអាភាស។

Liên kết liên quan (docs Cloudflare) Related links (Cloudflare docs) តំណពាក់ព័ន្ធ (docs Cloudflare)

Call get() trên biến ràng buộc Call get() on the binding variable Call get() នៅលើទំហំផ្សេងគ្នានេះ

Phần «Call get() on binding variable» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.

Read the "Call get() on the binding variable" section below — open the official docs link for full screenshots and configuration tabs.

អានផ្នែក «Call get() នៅលើទំហំផ្សេងគ្នានេះ» ខាងក្រោម — បើកតំណ docs ផ្លូវការសម្រាប់រូបភាព និង tab កំណត់។

Mở section docs gốc ↗ Open source section ↗ បើកផ្នែក docs ផ្លូវការ ↗
Phong cách phát triển địa phương
Local development mode
លក្ខខណ្ឌនៃការអភិវឌ្ឍ lokal
Bạn không thể tạo bí mật sản xuất access (được tạo trên bảng điều khiển, thông qua API, hoặc với lá cờ --remote) từ thiết lập phát triển cục bộ của bạn. Để sử dụng Secrets Store cục bộ, bạn phải sử dụng secrets-store secret Wrangler commands mà không có lá cờ --remote.
You cannot access production secrets (created on the dashboard, via API, or with the --remote flag) from your local development setup. To use Secrets Store locally, you must use secrets-store secret Wrangler commands without the --remote flag.
You cannot access production secrets (created on the dashboard, via API, or with the --remote flag) from your local development setup. To use Secrets Store locally, you must use secrets-store secret Wrangler commands without the --remote flag.
JavaScript Đánh giá
JavaScript
កុំព្យូទ័រ
text
export default {

  async fetch(request, env) {

    // Example of using the secret safely in an API request

    const APIkey = await env.<BINDING_VARIABLE>.get()


    const response = await fetch("https://api.example.com/data", {

      headers: { "Authorization": `Bearer ${APIKey}` },

    });


    if (!response.ok) {

      return new Response("Failed to fetch data", { status: response.status });

    }


    const data = await response.json();

    return new Response(JSON.stringify(data), {

      headers: { "Content-Type": "application/json" },

    });

  },

};
json
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"item":{"@id":"/directory/","name":"Directory"}},{"@type":"ListItem","position":2,"item":{"@id":"/secrets-store/","name":"Secrets Store"}},{"@type":"ListItem","position":3,"item":{"@id":"/secrets-store/integrations/","name":"Secrets Store integrations"}},{"@type":"ListItem","position":4,"item":{"@id":"/secrets-store/integrations/workers/","name":"Workers integration"}}]}

Liên kết liên quan (docs Cloudflare) Related links (Cloudflare docs) តំណពាក់ព័ន្ធ (docs Cloudflare)

Xem bản đầy đủ trên developers.cloudflare.com (ảnh, tab cấu hình). View the full guide on developers.cloudflare.com (images, config tabs). មើលមគ្គុទ្ទេសក៍ពេញលើ developers.cloudflare.com (រូបភាព, tab កំណត់)។

Tài liệu gốc ↗ Official docs ↗ ឯកសារផ្លូវការ ↗