aboutsummaryrefslogtreecommitdiff
path: root/mod/options.cli
blob: 888a5914f64c04848559bc3a37f5bb95588a1685 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
// file      : mod/options.cli -*- C++ -*-
// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
// license   : MIT; see accompanying LICENSE file

include <web/xhtml-fragment.hxx>;

include <libbrep/types.hxx>;

include <mod/options-types.hxx>;

namespace brep
{
  // Web module configuration options.
  //
  namespace options
  {
    // Option groups.
    //
    class module
    {
      string email
      {
        "<email>",
        "Repository email. This email is used for the \cb{From:} header in
         emails send by \cb{brep} (for example, build failure notifications)."
      }

      string host
      {
        "<host>",
        "Repository host. It specifies the scheme and the host address (but
         not the root path; see \cb{root} below) that will be used whenever
         \cb{brep} needs to construct an absolute URL to one of its locations
         (for example, a link to a build log that is being send via email)."
      }

      dir_path root = "/"
      {
        "<path>"
        "Repository root. That is, this is the part of the URL between the
         host name and the start of the repository. For example, root value
         '\cb{/pkg}' means the repository URL is \cb{http://example.org/pkg/}.
         Specify '\cb{/}' to use the web server root
         (\cb{http://example.org/})."
      }

      uint16_t verbosity = 0
      {
        "<level>",
        "Trace verbosity level. Level 0 disables tracing, which is also the
         default."
      }
    };

    class package_db
    {
      string package-db-user
      {
        "<user>",
        "Package database user name. If not specified, then operating system
         (login) name is used."
      }

      string package-db-password
      {
        "<pass>",
        "Package database password. If not specified, then login without
         password is expected to work."
      }

      string package-db-name = "brep_package"
      {
        "<name>",
        "Package database name. If not specified, then \cb{brep_package} is
         used by default."
      }

      string package-db-host
      {
        "<host>",
        "Package database host name, address, or socket. If not specified, then
         connect to \cb{localhost} using the operating system-default
         mechanism (Unix-domain socket, etc)."
      }

      uint16_t package-db-port = 0
      {
        "<port>",
        "Package database port number. If not specified, the default port is
         used."
      }

      size_t package-db-max-connections = 5
      {
        "<num>",
        "The maximum number of concurrent package database connections per web
         server process. If 0, then no limitation is applied. The default is
         5."
      }

      size_t package-db-retry = 10
      {
        "<num>",
        "The maximum number of times to retry package database transactions in
         the face of recoverable failures (deadlock, loss of connection, etc).
         The default is 10."
      }
    };

    class build
    {
      path build-config
      {
        "<buildtab>",
        "Build configuration file. If not specified, then the package building
         functionality will be disabled. If specified, then the build database
         must be configured (see \cb{build-db-*})."
      }

      size_t build-forced-rebuild-timeout = 600
      {
        "<seconds>",
        "Time to wait before considering a package for a forced rebuild. Must
         be specified in seconds. Default is 10 minutes."
      }

      size_t build-normal-rebuild-timeout = 86400
      {
        "<seconds>",
        "Time to wait before considering a package for a normal rebuild. Must
         be specified in seconds. Default is 24 hours."
      }
    };

    class build_db
    {
      string build-db-user
      {
        "<user>",
        "Build database user name. If not specified, then operating system
         (login) name is used."
      }

      string build-db-password
      {
        "<pass>",
        "Build database password. If not specified, then login without
         password is expected to work."
      }

      string build-db-name = "brep_build"
      {
        "<name>",
        "Build database name. If not specified, then \cb{brep_build} is used
         by default."
      }

      string build-db-host
      {
        "<host>",
        "Build database host name, address, or socket. If not specified, then
         connect to \cb{localhost} using the operating system-default
         mechanism (Unix-domain socket, etc)."
      }

      uint16_t build-db-port = 0
      {
        "<port>",
        "Build database port number. If not specified, the default port is
         used."
      }

      size_t build-db-max-connections = 5
      {
        "<num>",
        "The maximum number of concurrent build database connections per web
         server process. If 0, then no limitation is applied. The default is
         5."
      }

      size_t build-db-retry = 10
      {
        "<num>",
        "The maximum number of times to retry build database transactions in
         the face of recoverable failures (deadlock, loss of connection, etc).
         The default is 10."
      }
    };

    class page
    {
      web::xhtml::fragment logo
      {
        "<xhtml>",
        "Web page logo. It is displayed in the page header aligned to the left
         edge. The value is treated as an XHTML5 fragment."
      }

      vector<page_menu> menu;
      {
        "<label=link>",
        "Web page menu. Each entry is displayed in the page header in the
         order specified and aligned to the right edge. A link target that
         starts with '\cb{/}' or contains '\cb{:}' is used as is. Otherwise,
         it is prefixed with the repository web interface root."
      }
    };

    class search
    {
      uint16_t search-results = 10
      {
        "<num>",
        "Number of results per page. The default is 10."
      }

      uint16_t search-pages = 5
      {
        "<num>",
        "Number of pages in navigation (pager). The default is 5."
      }
    };

    class package
    {
      uint16_t package-description = 500
      {
        "<len>",
        "Number of package description characters to display in brief pages.
         The default is 500 (~ 80 characters * 6 lines)."
      }

      uint16_t package-changes = 5000;
      {
        "<len>",
        "Number of package changes characters to display in brief pages. The
         default is 5000 (~ 80 chars x 60 lines)."
      }
    };

    // Module options.
    //
    class package_search: search, package_db, page, module
    {
      string search-title = "Packages"
      {
        "<text>",
        "Package search page title. It is placed inside XHTML5 <title>
         element."
      }
    };

    class package_details: package, search, package_db, page, module
    {
    };

    class package_version_details: package, package_db, page, module
    {
    };

    class repository_details: package_db, page, module
    {
    };

    class build_task: build, package_db, build_db, module
    {
      size_t build-task-request-max-size = 102400
      {
        "<bytes>",
        "The maximum size of the build task request manifest accepted. Note
         that the HTTP POST request body is cached to retry database
         transactions in the face of recoverable failures (deadlock, loss of
         connection, etc). The default is 100K."
      }

      size_t build-result-timeout = 10800
      {
        "<seconds>",
        "Time to wait before considering the expected task result lost. Must be
         specified in seconds. The default is 3 hours."
      }
    };

    class build_result: build, package_db, build_db, module
    {
      size_t build-result-request-max-size = 10240000
      {
        "<bytes>",
        "The maximum size of the build result manifest accepted. Note that the
         HTTP POST request body is cached to retry database transactions in the
         face of recoverable failures (deadlock, loss of connection, etc). The
         default is 10M."
      }
    };

    class build_log: build, package_db, build_db, module
    {
    };

    class build_force: build, package_db, build_db, module
    {
    };

    class repository_root: module
    {
    };
  }

  // Web module HTTP request parameters.
  //
  namespace params
  {
    // Use parameters long names in the C++ code, short aliases (if present)
    // in HTTP URL.
    //
    class package_search
    {
      // Display package search result list starting from this page.
      //
      uint16_t page | p;

      // Package search criteria.
      //
      string query | q;
    };

    class package_details
    {
      // Display package version search result list starting from this page.
      //
      uint16_t page | p;

      // Package version search criteria.
      //
      string query | q;

      // Page form.
      //
      page_form form | f = page_form::brief;
    };

    class package_version_details
    {
      // Page form.
      //
      page_form form | f = page_form::brief;
    };

    class repository_details
    {
      // No parameters so far.
      //
    };

    class build_task
    {
      // Package repository display name.
      //
      vector<string> repository | r;
    };

    class build_result
    {
      // No parameters so far.
      //
    };

    class build_log
    {
      // No parameters so far.
      //
    };

    // All parameters are non-optional.
    //
    class build_force
    {
      // Package name.
      //
      string package | p;

      // Package version. May not be url-encoded, in which case the plus
      // character is considered literally (rather than as the encoded space
      // character). In other words, after url-decoding the space character is
      // treated the same way as the plus character.
      //
      // @@ Make it of the version type? Maybe after it get moved to
      //    libbpkg/types.hxx or at least the second use case appear.
      //
      string version | v;

      // Package build configuration.
      //
      string configuration | c;

      // Toolchain version. May not be url-encoded (see above).
      //
      string toolchain_version | t;

      // Package rebuild reason. Must not be empty.
      //
      string reason;
    };
  }
}