Skip to content

Commit d96a105

Browse files
Merge pull request #46 from opencomponents/docs-discovery-object-option
Document discovery option as boolean or object
2 parents 17f735f + 371125c commit d96a105

1 file changed

Lines changed: 38 additions & 4 deletions

File tree

‎website/docs/registry/registry-configuration.md‎

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,15 @@ For unsuscribing to all [events](#registry-events).
125125

126126
### Development and Discovery Options
127127

128-
| Parameter | Type | Mandatory | Default | Description |
129-
| ------------------------- | ----------------- | --------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
130-
| <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` |
128+
| Parameter | Type | Mandatory | Default | Description |
129+
| ------------------------------ | ----------------- | --------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
130+
| <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` |
132137
| <sub>local</sub> | boolean | no | - | Enables **local development mode** (what `oc dev` sets). Not a storage selector — see [Local development mode](#local-development-mode) |
133138
| <sub>path</sub> | string | no | - | Absolute path where local components are stored (required when `local` is `true`) |
134139
| <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);
253258
registry.start();
254259
```
255260

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 = new oc.Registry(configuration);
287+
registry.start();
288+
```
289+
256290
### Local Development Configuration
257291

258292
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

Comments
 (0)