Azure / data-api-builder

Data API builder provides modern REST and GraphQL endpoints to your Azure Databases and on-prem stores.
https://aka.ms/dab/docs
MIT License
879 stars 179 forks source link

[Enhancement]: Push users toward better practices #2230

Closed JerryNixon closed 3 weeks ago

JerryNixon commented 4 months ago

What happened?

Can we update dab init to create a .env file when a connection string is supplied?

Details:

  1. Create the .env file
  2. Use a default environment variable name my-connection-string

Simple .env file contents:

my-connection-string=whatever-the-user-provided
  1. Reference the environment variable name in the dab-config.json file.

Using variables in the JSON:

{
  "$schema": "...",
  "data-source": {
    "database-type": "mssql",
    "connection-string": "@env('my-connection-string')"
  }
}

Possible additional:

  1. Auto-create a .gitignore ignoring the .env file.

Simple .gitignore file contents:

.env

Considerations:

  1. What to do when there is already a .env file?
  2. What to do when there is already a .gitignore file?

Version

Future

What database are you using?

Azure SQL

What hosting model are you using?

Local (including CLI)

Which API approach are you accessing DAB through?

REST, GraphQL

Relevant log output

No response

Code of Conduct