Este conteúdo foi traduzido por máquina para sua conveniência e a Huawei Cloud não pode garantir que o conteúdo foi traduzido com precisão. Para exibir o conteúdo original, use o link no canto superior direito para mudar para a página em inglês.
Computação
Elastic Cloud Server
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Redes
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Gerenciamento e governança
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
Cloud Operations Center
Resource Governance Center
Migração
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Análises
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
IoT
IoT Device Access
Outros
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Segurança e conformidade
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Blockchain
Blockchain Service
Serviços de mídia
Media Processing Center
Video On Demand
Live
SparkRTC
Armazenamento
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Cloud Server Backup Service
Storage Disaster Recovery Service
Scalable File Service
Volume Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Bancos de dados
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Aplicações de negócios
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Data Lake Factory
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Distribuição de conteúdo e computação de borda
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Soluções
SAP Cloud
High Performance Computing
Serviços para desenvolvedore
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
Cloud Application Engine
MacroVerse aPaaS
KooPhone
KooDrive
Nesta página
Central de ajuda/ API Gateway/ Guia de usuário/ Gerenciamento de API/ Criação de uma variável de ambiente

Criação de uma variável de ambiente

Atualizado em 2024-10-14 GMT+08:00

Você pode definir variáveis de ambiente para permitir que uma API seja chamada em ambientes diferentes.

Environment variables são gerenciáveis e específicas para ambientes. Você pode adicionar variáveis em diferentes ambientes para chamar diferentes serviços de back-end usando a mesma API.

Para variáveis definidas durante a criação da API, você deve criar variáveis e valores correspondentes. Por exemplo, a variável Path é definida para uma API, e duas variáveis com o mesmo nome são criadas e recebem os valores /Stage/test e /Stage/AA nos ambientes 1 e 2, respectivamente. Se a API for publicada e chamada no ambiente 1, o caminho /Stage/test será usado. Se a API for publicada e chamada no ambiente 2, o caminho /Stage/AA será usado.

Figura 1 Uso de variáveis​de ambiente

Procedimento

  1. Vá para o console do APIG.
  1. Selecione um gateway dedicado na parte superior do painel de navegação.
  1. Escolha API Management > API Groups.
  2. Clique em um nome de grupo.
  3. Clique na guia Group Information.
  4. Na área Environment Variables, selecione um ambiente. Se nenhum ambiente estiver disponível, clique em Create Environment para criar um.
  5. Clique em Add Environment Variable e insira as informações da variável.

    Os nomes e valores das variáveis de ambiente serão exibidos em texto simples nas solicitações da API. Não inclua informações confidenciais nos nomes e valores das variáveis.

    Tabela 1 Adição de uma variável de ambiente

    Parâmetro

    Descrição

    Name

    Nome da variável. Verifique se o nome é igual ao nome da variável definida para a API.

    Value

    O caminho a ser usado no ambiente selecionado.

  6. Clique em OK.

Operações de acompanhamento

Depois de criar uma variável de ambiente, você pode publicar a API no ambiente onde a variável está localizada para que a API possa ser chamada.

Usamos cookies para aprimorar nosso site e sua experiência. Ao continuar a navegar em nosso site, você aceita nossa política de cookies. Saiba mais

Feedback

Feedback

Feedback

0/500

Conteúdo selecionado

Envie o conteúdo selecionado com o feedback