[DAEMON-57] appcd: Add support to config handler to change settings at runtime

GitHub Issuen/a
TypeNew Feature
Resolution Date2017-05-09T19:52:04.000+0000
Affected Version/sn/a
Fix Version/sAppc Daemon 1.0.0
Componentsappcd-config, appcd-config-service
ReporterChris Barber
AssigneeChris Barber


The config handler currently only returns the config. The handler should also support a "data" payload to change the daemon's config at runtime. Note that only a single config setting can be changed per call. Use the path to determine what is being changed. HTTP methods can be used to determine how the key should be changed. The handler returns the new value. Use the status code to determine if successful. The appcd CLI is responsible for persisting the settings to the user's config file ~/.appcelerator/appcd/config.json. The daemon does not modify the config file. The appcd CLI will validate the config change, then persist it to disk. After that, it will check if the daemon is running and attempt to change it at runtime. If the daemon is not running or it is running and the setting is changeable during runtime, then everything succeeds. If the daemon is running and the change is rejected, then the CLI will alert the user that the daemon must be restarted for the setting to take effect. If the CLI as a TTY, it can prompt to restart the daemon. Note that the CLI should also support a \-\-no\-prompt flag and a \-\-auto\-restart flag.


Getting a value:

appcd exec /appcd/config/analytics/enabled

appcd exec /appcd/config/analytics/enabled '{ "action": "get" }'

appcd exec /appcd/config '{ "action": "get", "key": "/analytics/enabled" }'

appcd exec /appcd/config '{ "action": "get", "key": "analytics.enabled" }'

Setting a value:

appcd exec /appcd/config '{ "action": "set", "key": "analytics.enabled", "value": true }'

appcd exec /appcd/config/analytics/enabled '{ "action": "set", "value": true }'

Deleting a value:

appcd exec /appcd/config '{ "action": "delete", "key": "analytics.enabled" }'

appcd exec /appcd/config/analytics/enabled '{ "action": "delete" }'

Array examples:

appcd exec /appcd/config '{ "action": "set", "key": "foo", "value": ["bar", "baz"] }'
Delete will remove the entire value.
appcd exec /appcd/config '{ "action": "delete", "key": "foo" }'


  1. Chris Barber 2017-05-09 https://github.com/appcelerator/appc-daemon/pull/11

JSON Source