Steeltoe Documentation
  • Why Steeltoe
    Overview Microservices Cloud Web Applications Event Driven
  • Get Started
    Steeltoe Initializr Guides Documentation API Browser Blog
  • Projects
    Steeltoe Application Configuration Steeltoe Circuit Breakers Steeltoe Dynamic Logging Steeltoe Management Steeltoe Messaging Steeltoe Network File Shares Steeltoe Security Steeltoe Service Connectors Steeltoe Service Discovery Steeltoe Stream
  • Support
  • Community
Search Results for

    Table of Contents
    . . .

    App Configuration with Cloud Foundry

    This tutorial takes you through setting up a .NET Core application that retrieves environment variable values from Cloud Foundry.

    Note

    For more detailed examples, please refer to the SimpleCloundFoundry project in the Steeltoe Samples Repository.

    First, create a .NET Core WebAPI that retrieves (configuration) environment variables from Cloud Foundry.

    1. Create a new ASP.NET Core WebAPI app with the Steeltoe Initializr
    2. Name the project "CloudFoundryExample"
    3. Add the "Cloud Foundry" dependency
    4. Click Generate Project to download a zip containing the new project

    Run the application.

    1. Publish the application locally using the .NET cli. The following command will create a publish folder automatically

      dotnet publish -o .\publish <PATH_TO>\CloudFoundryExample.csproj
      
    2. Create manifest.yml in the same folder as CloudFoundryExample.csproj

      ---
      applications:
        - name: Cloud_Foundry_Example
      buildpacks:
        - dotnet_core_buildpack
      stack: cflinuxfs3
      
      Note

      With yaml files indention and line endings matter. Use an IDE like VS Code to confirm spacing and that line endings are set to LF (not the Windows default CR LF)

    3. Push the app to Cloud Foundry

      cf push -f <PATH_TO>\manifest.yml -p .\publish
      
    4. Navigate to the application endpoint https://<APP_ROUTE>/api/values

    5. If all things go well you should see an output of configuration values provided by the Cloud Foundry platform

    X
    • Edit this page