Add kotlin dsl example to README.md (#107)

This commit is contained in:
Nils Druyen 2021-08-24 01:58:33 +02:00 коммит произвёл GitHub
Родитель 95e98ca801
Коммит de2204ee8f
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 49 добавлений и 1 удалений

Просмотреть файл

@ -24,6 +24,7 @@ plugins {
## Configuration
Here is a sample configuration, for details, please refer to this [document](https://github.com/microsoft/azure-gradle-plugins/wiki/Configuration).
### Groovy DSL
```groovy
azurefunctions {
subscription = <your subscription id>
@ -49,6 +50,31 @@ azurefunctions {
}
```
### Kotlin DSL
```kotlin
azurefunctions {
subscription = "<your subscription id>"
resourceGroup = "<your resource group>"
appName = "<your function app name>"
pricingTier = "<price tier like 'Consumption'>"
region = "<region like 'westus'>"
setRuntime(closureOf<com.microsoft.azure.gradle.configuration.GradleRuntimeConfig> {
os("Windows")
})
setAppSettings(closureOf<MutableMap<String, String>> {
put("key", "value")
})
setAuth(closureOf<com.microsoft.azure.gradle.auth.GradleAuthConfig> {
type = "azure_cli"
})
// enable local debug
// localDebug = "transport=dt_socket,server=y,suspend=n,address=5005"
setDeployment(closureOf<com.microsoft.azure.plugin.functions.gradle.configuration.deploy.Deployment> {
type = "run_from_blob"
})
}
```
## Usage
### Package Staging folder

Просмотреть файл

@ -22,6 +22,7 @@ plugins {
## Configuration
Here is a sample configuration, for details, please refer to this [document](https://github.com/microsoft/azure-gradle-plugins/wiki/Webapp-Configuration).
### Groovy DSL
```groovy
azurewebapp {
subscription = '<your subscription id>'
@ -37,13 +38,34 @@ azurewebapp {
appSettings {
<key> = <value>
}
auth {
type = 'azure_cli' // support azure_cli, oauth2, device_code and service_principal
}
}
```
### Kotlin DSL
```kotlin
azurewebapp {
subscription = "<your subscription id>"
resourceGroup = "<your resource group>"
appName = "<your app name>"
pricingTier = "<price tier like 'P1v2'>"
region = "<region like 'westus'>"
setRuntime(closureOf<com.microsoft.azure.gradle.configuration.GradleRuntimeConfig> {
os("Linux")
webContainer("Java SE")
javaVersion("Java 11")
})
setAppSettings(closureOf<MutableMap<String, String>> {
put("key", "value")
})
setAuth(closureOf<com.microsoft.azure.gradle.auth.GradleAuthConfig> {
type = "azure_cli"
})
}
```
## Usage
### Deploy your web project to Azure App Service