AppHarbor Configuration Variables Not Updating

drneel

I'm deploying a test application to AppHarbor and I'm trying to have AppHarbor update the configuration variables for the ElephantSQL add on when deploying.

These questions did help resolve my issue:

My AddOn Configuration Variable - Key: ELEPHANTSQL_URL

My Custom Configuration Variable - Key: foo Value: bar

Now looking at the AppHarbor documentation all I should have to do is set an appsetting to have the same name as the key above.

So here's my web.config:

  <connectionStrings>
    <add name="ELEPHANTSQL_URL" connectionString="Server=localhost;Database=foo;User Id=bar;Password=baz;" providerName="Npgsql" />
  </connectionStrings>
  <appSettings>
    <add key="ELEPHANTSQL_URL" value="dev"/>
    <add key="foo" value="baz"/>
  </appSettings>

And here's my web.release.config (which has been set to Build Action: Content)

  <connectionStrings>
    <add name="ELEPHANTSQL_URL" connectionString="release" providerName="Npgsql" xdt:Transform="Replace" />
  </connectionStrings>
  <appSettings>
    <add key="ELEPHANTSQL_URL" value="release" xdt:Transform="Replace" />
    <add key="foo" value="release" xdt:Transform="Replace" />
  </appSettings>

I would expect to see the release values in the web.config, but when I download the build source, I continue to see the dev values. Everything I have read says that appharbor deploys the release configuration and executes the transforms, but I cannot get it to work.

In the build log, there is no mention of the transformation, and I'm not sure if that's normal (see below).

Time Message
8/12/15 9:18 PM Received notification, queuing build
8/12/15 9:19 PM Downloading source
8/12/15 9:19 PM Downloaded source in 0.48 seconds
8/12/15 9:19 PM Starting NuGet package restore
8/12/15 9:19 PM NuGet package restore completed Show Log 8/12/15 9:19 PM Starting build
8/12/15 9:19 PM 0 warnings
8/12/15 9:19 PM Build completed in 3.9 seconds Show Log 8/12/15 9:19 PM Starting website precompilation
8/12/15 9:19 PM Precompilation completed in 11.24 seconds
8/12/15 9:19 PM Starting tests
8/12/15 9:19 PM Tests completed in 1.94 seconds
8/12/15 9:20 PM Deploying build
8/12/15 9:20 PM Website root content retrieved Show Log 8/12/15 9:20 PM Build successfully deployed

Here is the web.config in the build download:

  <connectionStrings>
        <add name="ELEPHANTSQL_URL" connectionString="Server=localhost;Database=foo;User Id=bar;Password=baz;" providerName="Npgsql" />
  </connectionStrings>
  <appSettings>
    <add key="ELEPHANTSQL_URL" value="dev" />
    <add key="foo" value="baz" />
  </appSettings>

I'm not sure what I'm missing.

Ideas?

drneel

So, I had a bug in my code, but the information below is what I used to understand what AppHarbor is doing with configuration variables and allowed me to fix it.

This article contains vague details about how the configuration variables work, but here's the TLDR.

  1. Configuration variables ONLY work with AppSettings; you cannot use them with connection strings
  2. The AppSettings key value must match the name of the Configuration Variable.
  3. Web.config transforms happen PRIOR to the Configuration Variable updates.
  4. The FINAL step is the AppSettings are updated with the Configuration Variables.

Note from AppHarbor support:

The production configuration for your app is not injected before the application is actually deployed, so if you download the build artifact from the build log page you won't see any of the new configuration - it's a "pristine" build and the configuration may change if you add/remove configuration variables, add-ons or in case the add-on provider pushes new settings to AppHarbor.

So if you need / want to validate that the AppSettings, you'll have to have a custom way of accessing that information (logging, controller action, etc)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related