aboutsummaryrefslogtreecommitdiff
path: root/mod/options.cli
blob: ba8b37b1e627a95ff2898f66c9de45b03707b07b (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
// file      : mod/options.cli -*- C++ -*-
// copyright : Copyright (c) 2014-2016 Code Synthesis Ltd
// license   : MIT; see accompanying LICENSE file

include <web/xhtml-fragment>;

include <brep/types>;

include <mod/options-types>;

namespace brep
{
  // Web module configuration options.
  //
  namespace options
  {
    // Option groups.
    //
    class module
    {
      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 http://example.org/pkg/.
         Specify '\cb{/}' to use the web server root (http://example.org/)."
      }

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

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

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

      string db-name = "brep"
      {
        "<name>",
        "Database name. If not specified, then '\cb{brep}' is used by
         default."
      }

      string db-host
      {
        "<host>",
        "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 db-port = 0
      {
        "<port>",
        "Database port number. If not specified, the default port is used."
      }

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

      size_t db-retry = 10
      {
        "<num>",
        "The maximum number of times to retry 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, db, page, module
    {
    };

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

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

    class repository_details: db, page, 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.
      //
    };
  }
}