publish

package
v1.17.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2023 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Overview

Package publish defines the exposure keys publishing API.

Package publish contains OpenCensus metrics and views for publish operations

Package publish defines the exposure keys publishing API.

Package publish defines the exposure keys publishing API.

Package publish defines the exposure keys publishing API.

Index

Constants

View Source
const (
	HeaderAPIVersion = "x-api-version"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

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"`
	Maintenance bool   `env:"MAINTENANCE_MODE, default=false"`

	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"`
	CreatedAtTruncateWindow  time.Duration `env:"TRUNCATE_WINDOW, default=1h"`

	// Symptom onset settings.
	// Maximum valid range. TEKs presneted with values outside this range, but still "reasonable" will not be saved.
	MaxMagnitudeSymptomOnsetDays uint `env:"MAX_SYMPTOM_ONSET_DAYS, default=14"`
	// MaxValidSymptomOnsetReportDays indicates how many days would be considered
	// a valid symptom onset report (-val..+val). Anything outside
	// that range would be subject to the default symptom onset flags (see below).
	MaxSymptomOnsetReportDays uint `env:"MAX_VALID_SYMPTOM_ONSET_REPORT_DAYS, default=28"`

	// TEKs that arrive without a days since symptom onset (i.e. no symptom onset date),
	// then the upload date minus DEFAULT_SYMPTOM_ONSET_DAYS_AGO is used.
	SymptomOnsetDaysAgo uint `env:"DEFAULT_SYMPTOM_ONSET_DAYS_AGO, default=4"`

	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=false"`

	// 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"`

	// LogJSONParseErrors will log errors from parsoning incoming requests if enabled.
	// The logs are at the WARN log level.
	LogJSONParseErrors bool `env:"LOG_JSON_PARSE_ERRORS, default=false"`

	// 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"`

	// Publish stats API config
	// Minimum number of publish requests that need to be present to see stats for a given day.
	// If the minimum is not met, that day is not revealed or shown in aggregates.
	// This value must be >= 10
	StatsUploadMinimum int64 `env:"STATS_UPLOAD_MINIMUM, default=10"`
	// Allow release of a day's stats after this much time has passed (measured from end of day).
	// Set to <= 0 to disable this feature.
	// If the value is positive, it must be >= 48h.
	StatsEmbargoPeriod           time.Duration `env:"STATS_EMBARGO_PERIOD, default=48h"`
	StatsResponsePaddingMinBytes int64         `env:"RESPONSE_PADDING_MIN_BYTES, default=2048"`
	StatsResponsePaddingRange    int64         `env:"RESPONSE_PADDING_RANGE, default=1024"`

	// ChaffRequestMaxLatencyMS prevents chaff request from consistently increasing latency
	// if the server is under abnormal load.
	ChaffRequestMaxLatencyMS uint64 `env:"CHAFF_REQUEST_MAX_LATENCY_MS, default=1000"`
}

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

func (*Config) AuthorizedAppConfig

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

func (*Config) DatabaseConfig

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

func (*Config) DebugReleaseSameDayKeys

func (c *Config) DebugReleaseSameDayKeys() bool

func (*Config) DefaultSymptomOnsetDaysAgo added in v0.16.0

func (c *Config) DefaultSymptomOnsetDaysAgo() uint

func (*Config) KeyManagerConfig

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

func (*Config) MaintenanceMode added in v0.17.0

func (c *Config) MaintenanceMode() bool

func (*Config) MaxExposureKeys

func (c *Config) MaxExposureKeys() uint

func (*Config) MaxIntervalStartAge

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

func (*Config) MaxSameDayKeys

func (c *Config) MaxSameDayKeys() uint

func (*Config) MaxSymptomOnsetDays

func (c *Config) MaxSymptomOnsetDays() uint

func (*Config) MaxValidSymptomOnsetReportDays added in v0.16.0

func (c *Config) MaxValidSymptomOnsetReportDays() uint

func (*Config) ObservabilityExporterConfig

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

func (*Config) SecretManagerConfig

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

func (*Config) TruncateWindow

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

func (*Config) Validate added in v0.16.0

func (c *Config) Validate() error

type Server added in v0.22.0

type Server struct {
	// contains filtered or unexported fields
}

func NewServer added in v0.22.0

func NewServer(ctx context.Context, cfg *Config, env *serverenv.ServerEnv) (*Server, error)

func (*Server) Routes added in v0.22.0

func (s *Server) Routes(ctx context.Context) *mux.Router

Directories

Path Synopsis
Package database is a database interface to publish.
Package database is a database interface to publish.
Package model is a model abstraction of publish.
Package model is a model abstraction of publish.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL