Skip to content

setup: add Viper config loading and internal package structure#10

Merged
Lewiskunta merged 4 commits into
mainfrom
setup/config
May 28, 2026
Merged

setup: add Viper config loading and internal package structure#10
Lewiskunta merged 4 commits into
mainfrom
setup/config

Conversation

@Lewiskunta

Copy link
Copy Markdown
Contributor

Implements - environment variable loading via Viper.

Changes:

  • Added github.com/spf13/viper and github.com/spf13/cobra
  • Created internal/config/config.go with full Config struct
  • Config reads from .env file, environment variables, and defaults
  • Validation for ENCRYPTION_KEY length, PORT range, required fields
  • Helper methods: IsProduction(), IsDevelopment(), BreachInterval()
  • Unit tests covering defaults, env var overrides, validation errors
  • Updated cmd/server/main.go to load config and log startup info
  • Structured JSON logging via log/slog (Go standard library)

After this PR, the server reads all configuration from environment variables. No hardcoded values anywhere.

@Lewiskunta Lewiskunta merged commit b7b6875 into main May 28, 2026
4 checks passed
@Lewiskunta Lewiskunta deleted the setup/config branch May 28, 2026 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant