exposure-notifications-server: github.com/google/exposure-notifications-server/internal/publish Index | Files | Directories

package publish

import "github.com/google/exposure-notifications-server/internal/publish"

Package publish defines the exposure keys publishing API.

Package publish defines the exposure keys publishing API.

Package publish defines the exposure keys publishing API.

Package publish defines the exposure keys publishing API.


Package Files

config.go publish.go publish_v1.go publish_v1alpha1.go


const (
    HeaderAPIVersion = "x-api-version"

type Config Uses

type Config struct {
    AuthorizedApp         authorizedapp.Config
    Database              database.Config
    SecretManager         secrets.Config
    KeyManager            keys.Config
    Verification          verification.Config
    ObservabilityExporter observability.Config
    RevisionToken         revision.Config

    Port             string `env:"PORT, default=8080"`
    MaxKeysOnPublish uint   `env:"MAX_KEYS_ON_PUBLISH, default=30"`
    // Provides compatibility w/ 1.5 release.
    MaxSameStartIntervalKeys     uint          `env:"MAX_SAME_START_INTERVAL_KEYS, default=3"`
    MaxIntervalAge               time.Duration `env:"MAX_INTERVAL_AGE_ON_PUBLISH, default=360h"`
    MaxMagnitudeSymptomOnsetDays uint          `env:"MAX_SYMPTOM_ONSET_DAYS, default=14"`
    CreatedAtTruncateWindow      time.Duration `env:"TRUNCATE_WINDOW, default=1h"`

    ResponsePaddingMinBytes int64 `env:"RESPONSE_PADDING_MIN_BYTES, default=1024"`
    ResponsePaddingRange    int64 `env:"RESPONSE_PADDING_RANGE, default=1024"`

    RevisionKeyCacheDuration time.Duration `env:"REVISION_KEY_CACHE_DURATION, default=1m"`

    // AllowPartialRevisions permits uploading multiple exposure keys with a
    // revision token where only a subset of the keys are in the token. In that
    // case, only the incoming exposure keys that match the revision token are
    // uploaded and the remainder are discarded.
    AllowPartialRevisions bool `env:"ALLOW_PARTIAL_REVISIONS, default=false"`

    // API Versions.
    EnableV1Alpha1API bool `env:"ENABLE_V1ALPHA1_API, default=true"`

    // If set and if a publish request has no regions (v1alpha1) and the health authority
    // has no regions configured, then this default will be assumed.
    // This is present for an upgrade edgecase where empty region list used to mean "all regions"
    // Should only be set if a server is being operated in a single region.
    DefaultRegion string `env:"DEFAULT_REGION"`

    // Flags for local development and testing. This will cause still valid keys
    // to not be embargoed.
    // Normally "still valid" keys can be accepted, but are embargoed.
    ReleaseSameDayKeys      bool `env:"DEBUG_RELEASE_SAME_DAY_KEYS"`
    DebugLogBadCertificates bool `env:"DEBUG_LOG_BAD_CERTIFICATES"`

Config represents the configuration and associated environment variables for the publish components.

func (*Config) AuthorizedAppConfig Uses

func (c *Config) AuthorizedAppConfig() *authorizedapp.Config

func (*Config) DatabaseConfig Uses

func (c *Config) DatabaseConfig() *database.Config

func (*Config) DebugReleaseSameDayKeys Uses

func (c *Config) DebugReleaseSameDayKeys() bool

func (*Config) KeyManagerConfig Uses

func (c *Config) KeyManagerConfig() *keys.Config

func (*Config) MaxExposureKeys Uses

func (c *Config) MaxExposureKeys() uint

func (*Config) MaxIntervalStartAge Uses

func (c *Config) MaxIntervalStartAge() time.Duration

func (*Config) MaxSameDayKeys Uses

func (c *Config) MaxSameDayKeys() uint

func (*Config) MaxSymptomOnsetDays Uses

func (c *Config) MaxSymptomOnsetDays() uint

func (*Config) ObservabilityExporterConfig Uses

func (c *Config) ObservabilityExporterConfig() *observability.Config

func (*Config) SecretManagerConfig Uses

func (c *Config) SecretManagerConfig() *secrets.Config

func (*Config) TruncateWindow Uses

func (c *Config) TruncateWindow() time.Duration

type PublishHandler Uses

type PublishHandler struct {
    // contains filtered or unexported fields

func NewHandler Uses

func NewHandler(ctx context.Context, config *Config, env *serverenv.ServerEnv) (*PublishHandler, error)

NewHandler creates common API handler for the publish API. This supports all current versions of the API and each defines it's own entry point via an http.HandlerFunc

func (*PublishHandler) Handle Uses

func (h *PublishHandler) Handle() http.Handler

Handle returns an http.Handler that can process V1 publish requests.

func (*PublishHandler) HandleV1Alpha1 Uses

func (h *PublishHandler) HandleV1Alpha1() http.Handler


databasePackage database is a database interface to publish.
modelPackage model is a model abstraction of publish.

Package publish imports 31 packages (graph). Updated 2020-09-21. Refresh now. Tools for package owners.