feat(acme): Improve certificate management by adding global ACME configuration support and allowing route-level overrides. Enhanced error messages help identify missing ACME email and misconfigurations (e.g. wildcard domains). Documentation has been updated and new tests added to verify SmartCertManager behavior, ensuring a clearer migration path from legacy implementations.
This commit is contained in:
@ -4,6 +4,12 @@
|
||||
- Package: `@push.rocks/smartproxy` – high-performance proxy supporting HTTP(S), TCP, WebSocket, and ACME integration.
|
||||
- Written in TypeScript, compiled output in `dist_ts/`, uses ESM with NodeNext resolution.
|
||||
|
||||
## Important: ACME Configuration in v19.0.0
|
||||
- **Breaking Change**: ACME configuration must be placed within individual route TLS settings, not at the top level
|
||||
- Route-level ACME config is the ONLY way to enable SmartAcme initialization
|
||||
- SmartCertManager requires email in route config for certificate acquisition
|
||||
- Top-level ACME configuration is ignored in v19.0.0
|
||||
|
||||
## Repository Structure
|
||||
- `ts/` – TypeScript source files:
|
||||
- `index.ts` exports main modules.
|
||||
@ -57,8 +63,32 @@
|
||||
- CLI entrypoint (`cli.js`) supports command-line usage (ACME, proxy controls).
|
||||
- ACME and certificate handling via `Port80Handler` and `helpers.certificates.ts`.
|
||||
|
||||
## ACME/Certificate Configuration Example (v19.0.0)
|
||||
```typescript
|
||||
const proxy = new SmartProxy({
|
||||
routes: [{
|
||||
name: 'example.com',
|
||||
match: { domains: 'example.com', ports: 443 },
|
||||
action: {
|
||||
type: 'forward',
|
||||
target: { host: 'localhost', port: 8080 },
|
||||
tls: {
|
||||
mode: 'terminate',
|
||||
certificate: 'auto',
|
||||
acme: { // ACME config MUST be here, not at top level
|
||||
email: 'ssl@example.com',
|
||||
useProduction: false,
|
||||
challengePort: 80
|
||||
}
|
||||
}
|
||||
}
|
||||
}]
|
||||
});
|
||||
```
|
||||
|
||||
## TODOs / Considerations
|
||||
- Ensure import extensions in source match build outputs (`.ts` vs `.js`).
|
||||
- Update `plugins.ts` when adding new dependencies.
|
||||
- Maintain test coverage for new routing or proxy features.
|
||||
- Keep `ts/` and `dist_ts/` in sync after refactors.
|
||||
- Keep `ts/` and `dist_ts/` in sync after refactors.
|
||||
- Consider implementing top-level ACME config support for backward compatibility
|
Reference in New Issue
Block a user