You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Sebastien Lorber (JIRA)" <ji...@apache.org> on 2015/09/03 13:05:45 UTC

[jira] [Commented] (CB-9607) Permits to override/customize config.xml settings with CLI build/run commands

    [ https://issues.apache.org/jira/browse/CB-9607?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14728860#comment-14728860 ] 

Sebastien Lorber commented on CB-9607:
--------------------------------------



Also, another interesting usecase would be to be able to "inject" directly from the command line global js variables.

For example running "cordova build --global-xxx=yyy" would make available a variable inside the js: cordova.global.xxx="yyy".
This would be very handy to avoid hardcoding env configuration directly inside the js app code.

> Permits to override/customize config.xml settings with CLI build/run commands
> -----------------------------------------------------------------------------
>
>                 Key: CB-9607
>                 URL: https://issues.apache.org/jira/browse/CB-9607
>             Project: Apache Cordova
>          Issue Type: Improvement
>          Components: CLI
>    Affects Versions: 5.1.1
>            Reporter: Sebastien Lorber
>
> I'm using a Cordova plugin for Intercom.
> Intercom is a SaaS service we use to track users. 
> They provide us 2 API keys, one for dev, and one for prod, because we don't want to melt test users with real users.
> I use the plugin with something like:
> {code}
>     <plugin name="cordova-plugin-intercom"                  spec="1.0.8"  >
>         <variable name="APP_ID" value="prodKey..." />
>     </plugin>
> {code}
> The problem is that currently, when I want to build the app for testing, I have to manually edit the config.xml file everytime to change the prodKey to devKey, and then relaunch cordova build android
> I have seen the platform options attributes of the build command (not really documented, a bit mentionned here CB-6024), but it does not seem to be what I look for.
> Some suggestions for a solution:
> {code}
>     <plugin name="cordova-plugin-intercom"                  spec="1.0.8"  >
>         <variable name="APP_ID" value="$INTERCOM_API_KEY:defaultValue" />
>     </plugin>
> {code}
> cordova build android -> will use "defaultValue"
> cordova build android --INTERCOM_API_KEY="overrideValue" -> will use "overrideValue"
> Another idea:
> {code}
>     <plugin name="cordova-plugin-intercom"                  spec="1.0.8"  >
>         <variable name="APP_ID" debugValue="devKey" releaseValue="prodKey" />
>     </plugin>
> {code}
> cordova build android --debug -> will use "devKey"
> cordova build android -- release -> will use "prodKey"
> ----------------------------
> See also: https://github.com/intercom/intercom-cordova/issues/1



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org