Skip to content

Introducing Enhanced Configuration and Versioning

Choose a tag to compare

@mligor mligor released this 06 Dec 14:07

Version: v0.5.0


New Features

Version Information Support

  • The module now supports embedding version information during the build process.
  • Use the following build flag to set the version dynamically:
    -ldflags '-X github.com/beanox/webservice.Version=1.2.3'
    
  • The version will be displayed in:
    • The GET /status endpoint response.
    • The --version command-line parameter.
  • Alternatively, set version info programmatically when creating a new service:
svc := NewSimpleService(&myImpl{},
    WithBuildInfo(BuildInfo{
        Version:   "1.0.0",
        BuildTime: "2024-03-14",
        CommitSHA: "abc123",
    }),
)

Breaking Changes

SimpleService Renamed to WebService

The SimpleService internal type has been renamed to WebService to better align with the module's purpose.
Service creation now supports additional options using functional parameters. Update your code as shown below:

// Before:
simpleService := webservice.NewSimpleService(&myImpl{})

// Now:
svc := NewSimpleService(&myImpl{},
    WithTimeouts(time.Second*30, time.Second*30, time.Second*120),
    WithBuildInfo(BuildInfo{
        Version:   "1.0.0",
        BuildTime: "2024-03-14",
        CommitSHA: "abc123",
    }),
)