Tier: Adapter · Status: Full · Java original:
firefly-config-server· .NET project:FireflyFramework.ConfigServer
configserver exposes a Spring-Cloud-Config-compatible REST
endpoint serving Environment payloads keyed by
(application, profile, label). Existing Java / .NET SDKs that
already speak Spring Cloud Config talk to it without modification.
The default MemoryStore is suitable for tests and development;
production deployments back onto a Git repository or a database via
the Store interface.
GET /{application}/{profile}[/{label}] returns:
{
"name": "orders",
"profiles": ["prod"],
"label": "main",
"version": "",
"state": "",
"propertySources": [
{
"name": "default",
"source": { "db.url": "jdbc:postgres://…" }
}
]
}A missing application/profile is a soft miss — the server returns
an empty propertySources array with the queried name and profile
echoed back. This matches Spring Cloud Config's behaviour so SDKs
don't break.
type PropertySource struct {
Name string
Source map[string]any
}
type Environment struct {
Name string
Profiles []string
Label string
Version string
State string
PropertySources []PropertySource
}
type Store interface {
Lookup(ctx, app, profile, label string) (Environment, error)
}
type MemoryStore struct{ ... }
func NewMemoryStore() *MemoryStore
func (*MemoryStore) Put(app, profile, label string, env Environment)
func Handler(store Store) http.Handlerimport (
"log"
"net/http"
"github.com/fireflyframework/fireflyframework-go/configserver"
)
store := configserver.NewMemoryStore()
store.Put("orders", "prod", "main", configserver.Environment{
Name: "orders",
Profiles: []string{"prod"},
Label: "main",
PropertySources: []configserver.PropertySource{{
Name: "default",
Source: map[string]any{"db.url": "jdbc:postgres://…"},
}},
})
log.Fatal(http.ListenAndServe(":8888", configserver.Handler(store)))Implement the Store interface — the rest of the framework, including
existing Spring Cloud Config clients, doesn't need to change.
cd configserver
go test ./...Covers seeded Environment lookup, soft-miss behaviour for unknown
applications, and JSON wire-shape compatibility.