1

My configuration code is setup in a way that default values are provided, and configuration files can be used to override these defaults.

For Azure Worker Roles I use the CloudConfigurationManager to read the configuration from the ServiceConfiguration.*.cscfg files for overriding the defaults.

A common reason for overriding the defaults is to provide different storage (blob,table,queue,etc) names during testing.

Unfortunately as far as I can tell, once a Setting has been defined in the ServiceDefinition.csdef file it must be provided in all ServiceConfiguration.*.cscfg files.

This wipes out the advantages of having less configuration to create and reducing the chance of errors creeping in while creating that configuration.

Is there a way to make a Setting optional?

Or is there another alternative place I can get deployment-specific configuration values from that works the way I want?

  • You could create environment specific configurations. By default you get 2: Debug and Cloud. Will that work for you? – Gaurav Mantri Nov 11 '16 at 09:59
  • I have environment specific configurations. The problem is if I want to override the defaults in one, I have to override them in all of them. To override the Setting in the Local config I have to define the Setting in the definition file. And if it's defined in the definition file then I *have* to add it to the Cloud file, even though I don't want to. That's why I'm asking if I can make them optional. –  Nov 11 '16 at 11:04
  • 1
    Aah...I see. As of today it is not possible to do with one csdef file. What you could do is have different cloud projects for each environment. Each cloud project will get its own set of csdef/cscfg files. – Gaurav Mantri Nov 11 '16 at 11:07
  • Thanks for the suggestion ... that's better than my current option of abandoning the cscfg files. –  Nov 11 '16 at 11:10

0 Answers0