Skip to content

Conversation

@stevengum
Copy link
Member

Changes

  • Add ARM template to flask core-bot for provisioning resources on azure

    • This ARM template creates a Linux App Service as Azure recommends using Linux to deploy your Python Apps
    • The template configures the App Service to build the code on the server by default
  • Updates config.py to import os and read environment variables, similar to the usage of process.env in the Node.js core-bot samples

APP_ID = os.environ.get("MicrosoftAppId", "")
APP_PASSWORD = os.environ.get("MicrosoftAppPassword", "")
LUIS_APP_ID = os.environ.get("LuisAppId", "")
LUIS_API_KEY = os.environ.get("LuisAPIKey", "")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious if you've seen this convention documented before? This seems to be combining configuration from files, with environment variables (and the environment variables don't appear to match the casing or spelling of the variables you reference in the code).

When we initially were discussing this earlier, these were referenced as convention for Python :

They do provide examples of environment variables, but don't appear to do indirection through the config object, just directly read into variables.

@axelsrz

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the reason I went went the variable keys above is because that's what we use when we provision bots on Azure. We can change the keys right now because we will be using Linux Web Apps instead of Windows Web Apps, but these are the keys we've used across C# and JS to use only one ARM template.

After some preliminary explorations and discussions, I think that the pattern I used above is the simplest way to get a local Python Flask sample bot deployed and running on Azure.

It populates the config with default values, but when deployed to a Linux App Service with the properly configured Application Settings, it reads the environment variables and so the code is ready to use in production.

@stevengum stevengum merged commit 9c7322b into master Jun 26, 2019
@stevengum stevengum deleted the stgum/arm-template branch June 26, 2019 21:09
@stevengum stevengum added the 4.5 label Jul 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants