Skip to content

Commit 81d5818

Browse files
domenkozarclaude
andcommitted
docs: consolidate concepts into declarative guide
Restructure documentation to provide clearer guidance by merging multiple concept pages into a single declarative.md file and simplifying the Rust SDK documentation. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent d75b549 commit 81d5818

File tree

7 files changed

+155
-430
lines changed

7 files changed

+155
-430
lines changed

docs/astro.config.mjs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,16 @@ export default defineConfig({
1616
{
1717
label: 'Getting Started',
1818
items: [
19-
{ label: 'Introduction', slug: 'introduction' },
2019
{ label: 'Quick Start', slug: 'quick-start' },
2120
{ label: 'Installation', slug: 'installation' },
2221
],
2322
},
2423
{
2524
label: 'Concepts',
2625
items: [
27-
{ label: 'Overview', slug: 'concepts/overview' },
26+
{ label: 'Declarative Configuration', slug: 'concepts/declarative' },
2827
{ label: 'Profiles', slug: 'concepts/profiles' },
2928
{ label: 'Providers', slug: 'concepts/providers' },
30-
{ label: 'Configuration Inheritance', slug: 'concepts/inheritance' },
3129
],
3230
},
3331
{
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
---
2+
title: Declarative Configuration
3+
description: Understanding secretspec.toml and its declarative approach
4+
---
5+
6+
SecretSpec uses `secretspec.toml` to declare what secrets your application needs, separating requirements from storage mechanisms for portability across environments.
7+
8+
## Basic Structure
9+
10+
```toml
11+
[project]
12+
name = "my-app"
13+
revision = "1.0"
14+
extends = ["../shared/common"] # Optional: inherit from other configs
15+
16+
[profiles.default]
17+
DATABASE_URL = { description = "PostgreSQL connection string", required = true }
18+
API_KEY = { description = "External API key", required = true }
19+
LOG_LEVEL = { description = "Logging verbosity", required = false, default = "info" }
20+
```
21+
22+
## Secret Declarations
23+
24+
Each secret is declared with configuration options:
25+
26+
```toml
27+
SECRET_NAME = {
28+
description = "Human-readable explanation", # Required: shown in prompts
29+
required = true, # Optional: defaults to true
30+
default = "value" # Optional: fallback if not set
31+
}
32+
```
33+
34+
**Options:**
35+
- `description`: Explains the secret's purpose (required)
36+
- `required`: Whether the secret must be provided (default: `true`)
37+
- `default`: Fallback value for optional secrets
38+
39+
## Configuration Inheritance
40+
41+
SecretSpec supports sharing common secrets across projects through the `extends` field.
42+
43+
### Basic Example
44+
45+
```toml
46+
# shared/common/secretspec.toml
47+
[project]
48+
name = "common"
49+
50+
[profiles.default]
51+
DATABASE_URL = { description = "Main database", required = true }
52+
LOG_LEVEL = { description = "Log verbosity", required = false, default = "info" }
53+
```
54+
55+
```toml
56+
# myapp/secretspec.toml
57+
[project]
58+
name = "myapp"
59+
extends = ["../shared/common"]
60+
61+
[profiles.default]
62+
DATABASE_URL = { description = "MyApp database", required = true } # Override
63+
API_KEY = { description = "External API key", required = true } # Add new
64+
```
65+
66+
### Monorepo Structure
67+
68+
```
69+
monorepo/
70+
├── shared/
71+
│ ├── base/secretspec.toml # Common secrets
72+
│ └── database/secretspec.toml # DB-specific (extends base)
73+
└── services/
74+
├── api/secretspec.toml # API service (extends database)
75+
└── frontend/secretspec.toml # Frontend (extends base)
76+
```
77+
78+
### Multiple Inheritance
79+
80+
```toml
81+
[project]
82+
name = "api-service"
83+
extends = ["../../shared/base", "../../shared/database", "../../shared/auth"]
84+
```
85+
86+
**Rules:**
87+
- Child definitions completely replace parent definitions
88+
- Later sources in `extends` override earlier ones
89+
- Each profile is merged independently
90+
- Paths are relative to the containing file
91+
92+
## Best Practices
93+
94+
1. **Descriptive names**: Use `STRIPE_API_KEY` instead of generic `API_KEY`
95+
2. **Clear descriptions**: Help developers understand each secret's purpose
96+
3. **Sensible defaults**: Provide development defaults, require production values
97+
4. **Modular inheritance**: Create reusable base configurations for common patterns
98+
99+
## Complete Example
100+
101+
```toml
102+
[project]
103+
name = "web-api"
104+
revision = "2.1.0"
105+
extends = ["../shared/base", "../shared/auth"]
106+
107+
[profiles.default]
108+
# Inherits DATABASE_URL, LOG_LEVEL from base
109+
# Inherits JWT_SECRET, SESSION_SECRET from auth
110+
# Service-specific additions:
111+
STRIPE_API_KEY = { description = "Stripe payment API", required = true }
112+
REDIS_URL = { description = "Redis cache connection", required = true }
113+
PORT = { description = "Server port", required = false, default = "3000" }
114+
```

docs/src/content/docs/concepts/inheritance.md

Lines changed: 0 additions & 83 deletions
This file was deleted.

docs/src/content/docs/concepts/overview.md

Lines changed: 0 additions & 153 deletions
This file was deleted.

docs/src/content/docs/installation.md

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,6 @@ environment.systemPackages = with pkgs; [
4343
];
4444
```
4545

46-
## From Source
47-
48-
To build from source, you'll need Rust installed:
49-
50-
```bash
51-
# Clone the repository
52-
$ git clone https://github.com/cachix/secretspec
53-
$ cd secretspec
54-
55-
# Build and install
56-
$ cargo install --path .
57-
```
58-
5946
## Verify Installation
6047

6148
After installation, verify that SecretSpec is available:

0 commit comments

Comments
 (0)