You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit d96a105
Browse filesBrowse the repository at this point in the historyBrowse files
| <sub>discovery</sub> | boolean | no |`true`| Enables the HTML discovery page and `/components` endpoint |
131
-
| <sub>discoveryFunc</sub> | function | no | - | Function to decide whether discovery should be enabled for the current request. Function signature: `(opts: { host?: string; secure: boolean }) => boolean`|
| <sub>discovery</sub> | boolean or object | no |`true`| Enables the HTML discovery page and `/components` endpoint. Pass a boolean to toggle everything at once, or an object to fine-tune individual aspects (see below) |
131
+
| <sub>discovery.robots</sub> | boolean | no |`true`| Appends a `<meta name="robots" content="index, follow" />` tag to the discovery page's HTML head. Set to `false` to append `noindex, nofollow` instead |
132
+
| <sub>discovery.api</sub> | boolean | no |`true`| Enables the discovery API endpoints (e.g. `/components`) |
133
+
| <sub>discovery.ui</sub> | boolean | no |`true`| Enables the HTML discovery page |
134
+
| <sub>discovery.validate</sub> | boolean | no |`false`| Enables validation for the discovery API |
135
+
| <sub>discovery.experimental</sub> | boolean | no |`true`| Shows experimental components in the discovery API. Has no effect when `discovery.api` is `false`|
136
+
| <sub>discoveryFunc</sub> | function | no | - | Function to decide whether discovery should be enabled for the current request. Function signature: `(opts: { host?: string; secure: boolean }) => boolean`|
132
137
| <sub>local</sub> | boolean | no | - | Enables **local development mode** (what `oc dev` sets). Not a storage selector — see [Local development mode](#local-development-mode)|
133
138
| <sub>path</sub> | string | no | - | Absolute path where local components are stored (required when `local` is `true`) |
134
139
| <sub>hotReloading</sub> | boolean | no |`!!local`| Enables hot-reloading of component code. Defaults to `true` when `local` is `true`|
@@ -253,6 +258,35 @@ var registry = new oc.Registry(configuration);
253
258
registry.start();
254
259
```
255
260
261
+
### Discovery Configuration
262
+
263
+
`discovery` accepts either a boolean (to enable/disable everything at once) or an object to configure the HTML discovery page and API independently:
264
+
265
+
```js
266
+
var oc =require("oc");
267
+
268
+
var configuration = {
269
+
baseUrl:"https://components.mycompany.com/",
270
+
port:3000,
271
+
discovery: {
272
+
ui:true, // Enable the HTML discovery page
273
+
api:true, // Enable the discovery API endpoints
274
+
validate:true, // Validate requests against the discovery API
275
+
experimental:false, // Hide experimental components from the discovery API
276
+
robots:false, // Add a noindex, nofollow meta tag to the discovery page
277
+
},
278
+
s3: {
279
+
bucket:"my-components-bucket",
280
+
region:"us-east-1",
281
+
componentsDir:"components",
282
+
path:"//s3.amazonaws.com/my-components-bucket/",
283
+
},
284
+
};
285
+
286
+
var registry =newoc.Registry(configuration);
287
+
registry.start();
288
+
```
289
+
256
290
### Local Development Configuration
257
291
258
292
Prefer `oc dev` over hand-rolling this. The CLI starts a registry with `local: true` and the right defaults for day-to-day component work.
0 commit comments