gcf-board 0.2.10 → 0.2.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -108,6 +108,20 @@ const MOVES = {
108
108
  // A column's new order after a drag: ranks 1, 2, 3… in one commit.
109
109
  prioritize: (b) => ['prioritize', ...runIds(b)],
110
110
  'question-answer': (b) => ['question', 'answer', id(b), `--text=${required(b, 'text')}`],
111
+ // One setting of gcf/config.yml; the core checks the key and the value. An empty value takes
112
+ // a number back to its default.
113
+ 'config-set': (b) => {
114
+ const key = b.key;
115
+ if (typeof key !== 'string' || !/^[a-z_]+(\.[a-z_]+)?$/.test(key))
116
+ throw new HttpError(400, 'key must be a config key');
117
+ // A missing value is a mistake, not a reset: only an empty one takes the default back.
118
+ const v = b.value;
119
+ if (v === undefined || v === null)
120
+ throw new HttpError(400, 'value is required');
121
+ if (typeof v !== 'string' && typeof v !== 'number')
122
+ throw new HttpError(400, 'value must be text');
123
+ return ['config', 'set', key, `--value=${v}`];
124
+ },
111
125
  // A deny group on or off, a custom rule added or removed; the core checks the names.
112
126
  permissions: (b) => {
113
127
  const args = ['on', 'off', 'deny', 'undeny'].flatMap((k) => many(b, k));