Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
theoephraim committed Jan 15, 2025
1 parent 85d1f40 commit a6f6659
Show file tree
Hide file tree
Showing 15 changed files with 105 additions and 99 deletions.
2 changes: 0 additions & 2 deletions packages/core/src/config-engine/config-engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ export type DmnoServiceConfig = {
tags?: Array<string>,
};



export type InjectedDmnoEnvItem = {
value: any,
dynamic?: boolean | 1 | '1',
Expand Down
1 change: 1 addition & 0 deletions packages/docs-site/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ module.exports = {
],
rules: {
"import/no-unresolved": 0,
"object-curly-newline": 0,
"@typescript-eslint/no-unused-vars": 0,
"import/no-extraneous-dependencies": 0,
},
Expand Down
10 changes: 7 additions & 3 deletions packages/docs-site/astro.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import partytown from '@astrojs/partytown';
import IconsVitePlugin from 'unplugin-icons/vite';
import sitemap from '@astrojs/sitemap';
import dmnoAstroIntegration from '@dmno/astro-integration';
import remarkCustomHeaderId from 'remark-custom-header-id';

// https://astro.build/config
export default defineConfig({
Expand All @@ -24,6 +25,11 @@ export default defineConfig({
// },
},
trailingSlash: 'always',
markdown: {
remarkPlugins: [
remarkCustomHeaderId,
],
},
integrations: [
dmnoAstroIntegration(),
starlight({
Expand Down Expand Up @@ -159,7 +165,6 @@ export default defineConfig({
],
}, {
label: 'Plugins',
badge: 'New',
items: [
{
label: 'Overview',
Expand All @@ -184,7 +189,6 @@ export default defineConfig({
],
}, {
label: 'Integrations',
badge: 'New',
items: [
{ label: 'Overview', link: '/docs/integrations/overview/' },
{ label: 'Remix', link: '/docs/integrations/remix/' },
Expand All @@ -196,7 +200,6 @@ export default defineConfig({
],
}, {
label: 'Platforms',
badge: 'New',
items: [
{
label: 'Overview',
Expand All @@ -205,6 +208,7 @@ export default defineConfig({
{
label: 'Cloudflare',
link: '/docs/platforms/cloudflare/',
badge: 'New',
},
{
label: 'Netlify',
Expand Down
3 changes: 2 additions & 1 deletion packages/docs-site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
"@astrojs/starlight": "^0.25.4",
"@astrojs/vue": "^4.5.0",
"@dmno/astro-integration": "workspace:*",
"@dmno/eslint-config": "workspace:*",
"@dmno/cloudflare-platform": "workspace:*",
"@dmno/eslint-config": "workspace:*",
"@dmno/tsconfig": "workspace:*",
"@dmno/ui-lib": "workspace: *",
"@iconify/vue": "^4.1.2",
Expand All @@ -41,6 +41,7 @@
"less": "^4.2.0",
"nanostores": "^0.10.3",
"postcss-nested": "^7.0.2",
"remark-custom-header-id": "^1.0.0",
"sharp": "^0.33.4",
"starlight-blog": "^0.11.1",
"starlight-links-validator": "^0.10.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ While TypeScript is not required in your applications, you will get the full fea

3. ### **Write your schema**

The config schema and other settings live in the `.dmno/config.mts` files. `dmno init` does its best to scaffold out the initial version of this schema but it should be reviewed. Updating each item with a description, [`required`](/docs/guides/schema/#validations--required-config), and [`sensitive`](/docs/guides/schema/#secrets--security) is a great next step. You can then improve your schema over time, adding validations, and setting values from within the schema itself.
The config schema and other settings live in the `.dmno/config.mts` files. `dmno init` does its best to scaffold out the initial version of this schema but it should be reviewed. Updating each item with a description, [`required`](/docs/guides/schema/#validation), and [`sensitive`](/docs/guides/schema/#sensitive) is a great next step. You can then improve your schema over time, adding validations, and setting values from within the schema itself.

Your initial schema should look something like this:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default defineDmnoService({
//...
```

See [schema guide > security](/docs/guides/schema/#secrets--security) for more details about customizing redaction behaviour.
See [schema guide > security](/docs/guides/schema/#redact-mode) for more details about customizing redaction behaviour.


### External HTTP request scanning
Expand Down
4 changes: 2 additions & 2 deletions packages/docs-site/src/content/docs/docs/guides/env-files.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Learn how DMNO uses `.env` files to scaffold out your config schema
---

DMNO uses `.env` files in two ways:
1. To scaffold out the initial [`schema`](/docs/guides/schema/#defining-config-items) in your `config.mts` files when your run `dmno init`
1. To scaffold out the initial [`schema`](/docs/guides/schema) in your `config.mts` files when your run `dmno init`
2. To set value overrides to be used while resolving your config values

Let's zoom in on each of these.
Expand Down Expand Up @@ -40,7 +40,7 @@ Whenever we are resolving your configuration values, dmno will load any `.env` f
To decide which `.env.*` files to enable, we use the current value of `NODE_ENV` that we find in actual environment variables via `process.env`, not any value set via your schema or another `.env` file.
:::

While we support it, **we do not recommend using complicated `.env` file setups like this within dmno!** It is supported purely to ease migration. Instead we recommend migrating this logic into the schema itself - setting values using functions and helpers like `switchBy` to express more complex overriding behaviour, and using plugins to load sensitive values securely. See our [Schema Authoring guide](/docs/guides/schema/#setting-item-values) for more details.
While we support it, **we do not recommend using complicated `.env` file setups like this within dmno!** It is supported purely to ease migration. Instead we recommend migrating this logic into the schema itself - setting values using functions and helpers like `switchBy` to express more complex overriding behaviour, and using plugins to load sensitive values securely. See our [Schema Authoring guide](/docs/guides/schema/#value) for more details.

We do, however, recommend using a single gitignored `.env.local` file to store any overrides you want to apply locally. This can be useful for short-lived temporary settings that you may want to toggle during development - like flags that enable certain debugging related features. It's also where we recommend storing sensitive keys that you don't want checked into version control; values that in deployed environments you would set via actual environment variables.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ There are a few different ways you can adopt DMNO incrementally:
- You can start by adding DMNO to a single service, and then gradually add it to more services as needed. If you're in a monorepo, it's best to start with some root config and then incrementally add a service at a time.

**Feature by feature**:
- Mark items as `required` and `sensitive`
- Add descriptions to items to [automatically attach documentation](/docs/guides/schema/#docs--intellisense)
- Add [specific types](/docs/guides/schema/#data-types--extends) to each of the config items
- Then add custom [validation rules](/docs/guides/schema/#validations--required-config), coercion, and custom types
- Set [values](/docs/guides/schema/#setting-item-values) from the schema itself (e.g., functions, switching [based on environment](/docs/guides/multi-env/))
- Mark items as `required` and [`sensitive`](/docs/guides/schema/#sensitive)
- Add descriptions to items to [automatically attach documentation](/docs/guides/schema/#docs)
- Add [specific types](/docs/guides/schema/#data-type) to each of the config items
- Then add custom [validation rules](/docs/guides/schema/#validation), coercion, and custom types
- Set [values](/docs/guides/schema/#value) from the schema itself (e.g., functions, switching [based on environment](/docs/guides/multi-env/))
- Add [plugins](/docs/plugins/overview/) to fetch the config values from a secure source

**In your code**:
Expand Down
Loading

0 comments on commit a6f6659

Please sign in to comment.