Enhance build system and logging configuration

- Add scripts/build.sh to compile binaries into bin/ directory

- Move all zerolog setup logic from cmd/server/main.go to pkg/config

- Add log level configuration support (trace, debug, info, warn, error, fatal, panic)

- Simplify cmd/server/main.go from 57 to 27 lines (53% reduction)

- Update .gitignore to use bin/ directory instead of individual files

- Document build process and bin directory in AGENTS.md

- Maintain backward compatibility with all existing functionality
This commit is contained in:
2026-04-04 13:24:33 +02:00
parent 9855f521f3
commit 00e796c608
6 changed files with 119 additions and 36 deletions

View File

@@ -355,12 +355,37 @@ go test ./...
go test ./pkg/greet/
```
### 5. Make Changes
### 5. Build Binaries
The project uses a build script to compile binaries into the `bin/` directory:
```bash
# Build both server and greet binaries
./scripts/build.sh
# This creates:
# - ./bin/server - The web server binary
# - ./bin/greet - The CLI greeting tool
```
**Binary Usage:**
```bash
# Run the server
./bin/server
# Use the greet CLI
./bin/greet # Output: Hello world!
./bin/greet John # Output: Hello John!
```
**The `bin/` directory is gitignored** to prevent binary files from being committed to the repository.
### 6. Make Changes
- Edit source files in `pkg/` or `cmd/`
- Follow existing patterns and interfaces
- Add tests for new functionality
### 6. Stop and Restart
### 7. Stop and Restart
```bash
./scripts/start-server.sh restart
```