Managing environment settings and configuration

6 posts, 0 answers
  1. Aaron
    Aaron avatar
    4 posts
    Member since:
    Aug 2013

    Posted 14 Aug 2013 Link to this post

    Within an Icenium project (or perhaps mobile development in general). Is there an automated way of managing configuration settings that may change between environments?

    Currently our app has settings such as service URLs to point at out development environment. What we would like is to be able to choose a 'build configuration' or similar and have the app use a particular set of configuration settings. Currently we would have to manually change the app before deployment to ensure the correct settings are used.

    Cheers
    Aaron
  2. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 14 Aug 2013 Link to this post

    Hi Aaron,

    Currently there is no way to handle such scenario, but it has been requested by other users as well and is logged into our backlog for investigation.

    Regards,
    Steve
    Telerik

    Do you enjoy Icenium? Vote for it as your favorite new product here (use short code H048S).
    Looking for tips & tricks directly from the Icenium team? Check out our blog!
    Share feedback and vote for features on our Feedback Portal.
  3. Aaron
    Aaron avatar
    4 posts
    Member since:
    Aug 2013

    Posted 14 Aug 2013 Link to this post

    Thanks Steve.
    Such functionliy would be much appreciated as it would go one step closer to deployment automation.

    In the interim I have implemented a simple code solution. I have a config.js file containing the following code structure (using require.js/MVVM techniques):

    define([], function () {
         
        devConfig =
            {
                serviceUrl : "https://localhost/Service.svc/"
            };
         
        testConfig =
            {
                serviceUrl : "https://test/Service.svc/"
            };
         
        prodConfig =
            {
                serviceUrl : "https://prod/Service.svc/",
            };
         
        //These setting are consistent across all environments
        var serviceErrorText = "There was a problem communicating with the server. Please try again later.";
        var databaseName = "myDB";
         
        //Set this config to point to the right configuration above for the intended environment
        var currentConfig = devConfig;
         
        return {
           serviceUrl: currentConfig.serviceUrl,
           serviceErrorText: serviceErrorText,
           databaseName: databaseName
        };
    });
  4. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 15 Aug 2013 Link to this post


    Aaron, thank you for sharing your solution with the community!

    Regards,
    Steve
    Telerik

    Do you enjoy Icenium? Vote for it as your favorite new product here (use short code H048S).
    Looking for tips & tricks directly from the Icenium team? Check out our blog!
    Share feedback and vote for features on our Feedback Portal.
  5. Ozzy
    Ozzy avatar
    6 posts
    Member since:
    Dec 2011

    Posted 10 Feb 2014 Link to this post

    Hi Aaron.  Can you provide a small code sample of how you access these config settings in your other code.

    Thanks in advance.
    Ozzy
  6. Aaron
    Aaron avatar
    11 posts
    Member since:
    Jul 2013

    Posted 10 Feb 2014 in reply to Ozzy Link to this post

    Hi Ozzy

    We are using require.js techniques to include scripts. Our configuration setting are kept in a file called config.js and included when required like this (the require js way): 
    define(["app/config"], function (config) {
       //Then we can access the config properties via the included 'config' object
      var myUrl = config.ServerUrl;
    });









Back to Top