Initial commit of Descrybe v2 without local scratch artifacts.
Drop one-shot tmp/axe scripts and agent i18n scratch so the Gitea tree is deployable.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package platformsettings
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/descrybe/descrybe-v2/apps/api/internal/eprel"
|
||||
)
|
||||
|
||||
// DynamicEPREL resolves platform settings on each call so admin changes
|
||||
// apply without restarting the worker.
|
||||
type DynamicEPREL struct {
|
||||
Settings *Service
|
||||
}
|
||||
|
||||
func (d *DynamicEPREL) Enabled() bool {
|
||||
if d == nil || d.Settings == nil {
|
||||
return false
|
||||
}
|
||||
opts, err := d.Settings.ResolveEPREL(context.Background())
|
||||
return err == nil && opts.Enabled
|
||||
}
|
||||
|
||||
func (d *DynamicEPREL) Fetch(ctx context.Context, eprelID string) (*eprel.Data, error) {
|
||||
if d == nil || d.Settings == nil {
|
||||
return nil, nil
|
||||
}
|
||||
client, err := d.Settings.NewEPRELClient(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return client.Fetch(ctx, eprelID)
|
||||
}
|
||||
Reference in New Issue
Block a user