Notitie
Voor toegang tot deze pagina is autorisatie vereist. U kunt proberen u aan te melden of de directory te wijzigen.
Voor toegang tot deze pagina is autorisatie vereist. U kunt proberen de mappen te wijzigen.
Data API Builder ondersteunt meerdere configuratieomgevingen, vergelijkbaar met ASP.NET Core appsettings.json. U kunt een basisconfiguratie () en omgevingsspecifieke varianten (dab-config.jsondab-config.Development.json,dab-config.Production.json) definiƫren. Deze functie maakt het flexibel beheer van verbindingsreeksen, verificatie-instellingen en andere configuratiewijzigingen in omgevingen mogelijk.
Stap 1: Een basisconfiguratie maken
.env Een bestand maken
DEV_CONNECTION_STRING=Server=tcp:127.0.0.1,1433;User ID=<username>;Password=<password>;
PROD_CONNECTION_STRING=Server=tcp:127.0.0.1,1433;User ID=<username>;Password=<password>;
Opmerking
Het .env bestand heeft geen bestandsnaam, alleen een extensie.
Uitvoeren dab init om het basisconfiguratiebestand te maken
dab init --database-type "mssql" --connection-string ""
dab add Book --source "dbo.Books" --permissions "anonymous:*"
Deze stap produceert een basisbestand dab-config.json dat wordt gedeeld in alle omgevingen.
Stap 2: omgevingsspecifieke configuratiebestanden toevoegen
- dab-config.json
- dab-config.Development.json
- dab-config.Production.json
Configuratiebestand voor ontwikkeling (dab-config.Development.json)
{
"data-source": {
"connection-string": "@env('DEV_CONNECTION_STRING')"
}
}
Productieconfiguratiebestand (dab-config.Production.json)
{
"data-source": {
"connection-string": "@env('PROD_CONNECTION_STRING')"
}
}
Opmerking
Omgevingsspecifieke bestanden overschrijven de basisconfiguratie wanneer DAB_ENVIRONMENT deze is ingesteld.
Stap 3: DAB starten met de juiste omgeving
Gebruik deze opdracht om de omgeving in te stellen op Development:
DAB_ENVIRONMENT=Development dab start
Gebruik deze opdracht om de omgeving in te stellen op Production:
DAB_ENVIRONMENT=Production dab start
Opmerking
Als er geen omgeving is ingesteld, is Productionde standaardomgeving.
Stap 4: De installatie controleren
- REST:
http://localhost:5000/api/Book - GraphQL:
http://localhost:5000/graphql - Swagger:
http://localhost:5000/swagger - Gezondheid:
http://localhost:5000/health