fix(14.3-01): ship http body limits in examples/hello
- add examples/hello/config/http.yaml so serve, route:list and TestTypedItemRoute work without a manual config step - drop the matching setup step and known-issue notes from README.md and docs/setup/installation.md
This commit is contained in:
11
README.md
11
README.md
@@ -38,15 +38,7 @@ The `migrate`, `migrate:status`, `migrate:rollback`, `serve` and admin commands
|
||||
CREATE DATABASE hello;
|
||||
```
|
||||
|
||||
2. Add the request body limits that `serve` and `route:list` require. The example does not ship them yet, and surf needs numeric values, which the string-valued environment overlay cannot supply. Create `config/http.yaml` in `examples/hello`:
|
||||
|
||||
```yaml
|
||||
body_limits:
|
||||
default_bytes: 1048576
|
||||
upload_bytes: 10485760
|
||||
```
|
||||
|
||||
3. Point the binary at the database, give it an application key and an uploads bucket, then migrate and serve:
|
||||
2. Point the binary at the database, give it an application key and an uploads bucket, then migrate and serve:
|
||||
|
||||
```sh
|
||||
./bin/hello key:generate # prints a base64 key; copy the value
|
||||
@@ -63,7 +55,6 @@ The `migrate`, `migrate:status`, `migrate:rollback`, `serve` and admin commands
|
||||
|
||||
### Known issues
|
||||
|
||||
- `examples/hello` has no `http.body_limits` configuration, so `serve` and `route:list` fail with `surf: config http.body_limits.default_bytes is required` until you add it as in step 2. The same gap makes the example's `TestTypedItemRoute` fail.
|
||||
- The committed `examples/hello/main.go` is older than what `summer build` generates now, so building the example (or running its tests, which build it) leaves that file modified. Restore it with `git checkout -- examples/hello/main.go` if you do not intend to commit it.
|
||||
|
||||
## Repository layout
|
||||
|
||||
@@ -90,15 +90,7 @@ CREATE DATABASE hello;
|
||||
|
||||
Configuration comes from YAML files in `config/`. Any key can be overridden with a `SUMMER_` environment variable, in which a double underscore separates path segments: `SUMMER_DATABASE__DSN` sets `database.dsn`. [Configuration](configuration.md) explains the layers.
|
||||
|
||||
`serve` and `route:list` need request body limits, and surf reads them as numbers, which the string-valued environment overlay cannot supply. Create `config/http.yaml` in `examples/hello`:
|
||||
|
||||
```yaml
|
||||
body_limits:
|
||||
default_bytes: 1048576
|
||||
upload_bytes: 10485760
|
||||
```
|
||||
|
||||
Then point the binary at the database, give it the application key and an uploads bucket. Replace the `<secret>` markers with your own values, and never commit them:
|
||||
Point the binary at the database, give it the application key and an uploads bucket. Replace the `<secret>` markers with your own values, and never commit them:
|
||||
|
||||
```sh
|
||||
export SUMMER_DATABASE__DSN='postgres://acme:<secret>@127.0.0.1:5432/hello?sslmode=disable'
|
||||
@@ -122,7 +114,6 @@ From the application directory, `summer migrate`, `summer migrate:status` and `s
|
||||
> [!WARNING]
|
||||
> Known issues in the current framework:
|
||||
>
|
||||
> - `examples/hello` ships no `http.body_limits` configuration, so `serve` and `route:list` fail with `surf: config http.body_limits.default_bytes is required` until you add `config/http.yaml` as shown above. The same gap makes the example's `TestTypedItemRoute` fail.
|
||||
> - The committed `examples/hello/main.go` is older than what `summer build` generates now, so building the example leaves that file modified. Restore it with `git checkout -- examples/hello/main.go` if you do not intend to commit it.
|
||||
|
||||
## Next steps
|
||||
|
||||
5
examples/hello/config/http.yaml
Normal file
5
examples/hello/config/http.yaml
Normal file
@@ -0,0 +1,5 @@
|
||||
body_limits:
|
||||
# Request body limits in bytes, required by serve and route:list. Keep them
|
||||
# YAML numbers: values from the environment are strings and are rejected.
|
||||
default_bytes: 1048576
|
||||
upload_bytes: 10485760
|
||||
Reference in New Issue
Block a user