config

package
v0.165.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2021 License: Apache-2.0 Imports: 20 Imported by: 252

Documentation

Index

Constants

View Source
const MIN_COOKIE_SIZE_BYTES = 500

Variables

View Source
var ResolvedInterstitialSizes = []InterstitialSize{}/* 250 elements not displayed */

ResolvedInterstitialSizes is a list of sizes sorted by size (larger first) and frequency (more common sizes first) since that seemed like a reasonable weight balancing the two factors. Originally sources from AppNexus/Xandr stats.

Functions

func SetupViper

func SetupViper(v *viper.Viper, filename string)

Set the default config values for the viper object we are using.

Types

type Account

type Account struct {
	ID            string      `mapstructure:"id" json:"id"`
	Disabled      bool        `mapstructure:"disabled" json:"disabled"`
	CacheTTL      DefaultTTLs `mapstructure:"cache_ttl" json:"cache_ttl"`
	EventsEnabled bool        `mapstructure:"events_enabled" json:"events_enabled"`
	CCPA          AccountCCPA `mapstructure:"ccpa" json:"ccpa"`
	GDPR          AccountGDPR `mapstructure:"gdpr" json:"gdpr"`
	DebugAllow    bool        `mapstructure:"debug_allow" json:"debug_allow"`
}

Account represents a publisher account configuration

type AccountCCPA

type AccountCCPA struct {
	Enabled            *bool              `mapstructure:"enabled" json:"enabled,omitempty"`
	IntegrationEnabled AccountIntegration `mapstructure:"integration_enabled" json:"integration_enabled"`
}

AccountCCPA represents account-specific CCPA configuration

func (*AccountCCPA) EnabledForIntegrationType

func (a *AccountCCPA) EnabledForIntegrationType(integrationType IntegrationType) *bool

EnabledForIntegrationType indicates whether CCPA is turned on at the account level for the specified integration type by using the integration type setting if defined or the general CCPA setting if defined; otherwise it returns nil

type AccountGDPR

type AccountGDPR struct {
	Enabled                 *bool              `mapstructure:"enabled" json:"enabled,omitempty"`
	IntegrationEnabled      AccountIntegration `mapstructure:"integration_enabled" json:"integration_enabled"`
	BasicEnforcementVendors []string           `mapstructure:"basic_enforcement_vendors" json:"basic_enforcement_vendors"`
}

AccountGDPR represents account-specific GDPR configuration

func (*AccountGDPR) EnabledForIntegrationType

func (a *AccountGDPR) EnabledForIntegrationType(integrationType IntegrationType) *bool

EnabledForIntegrationType indicates whether GDPR is turned on at the account level for the specified integration type by using the integration type setting if defined or the general GDPR setting if defined; otherwise it returns nil

type AccountIntegration

type AccountIntegration struct {
	AMP   *bool `mapstructure:"amp" json:"amp,omitempty"`
	App   *bool `mapstructure:"app" json:"app,omitempty"`
	Video *bool `mapstructure:"video" json:"video,omitempty"`
	Web   *bool `mapstructure:"web" json:"web,omitempty"`
}

AccountIntegration indicates whether a particular privacy policy (GDPR, CCPA) is enabled for each integration type

func (*AccountIntegration) GetByIntegrationType

func (a *AccountIntegration) GetByIntegrationType(integrationType IntegrationType) *bool

GetByIntegrationType looks up the account integration enabled setting for the specified integration type

type Adapter

type Adapter struct {
	Endpoint string `mapstructure:"endpoint"` // Required
	// UserSyncURL is the URL returned by /cookie_sync for this Bidder. It is _usually_ optional.
	// If not defined, sensible defaults will be derived based on the config.external_url.
	// Note that some Bidders don't have sensible defaults, because their APIs require an ID that will vary
	// from one PBS host to another.
	//
	// For these bidders, there will be a warning logged on startup that usersyncs will not work if you have not
	// defined one in the app config. Check your app logs for more info.
	//
	// This value will be interpreted as a Golang Template. At runtime, the following Template variables will be replaced.
	//
	//   {{.GDPR}}      -- This will be replaced with the "gdpr" property sent to /cookie_sync
	//   {{.Consent}}   -- This will be replaced with the "consent" property sent to /cookie_sync
	//   {{.USPrivacy}} -- This will be replaced with the "us_privacy" property sent to /cookie_sync
	//
	// For more info on templates, see: https://golang.org/pkg/text/template/
	UserSyncURL      string `mapstructure:"usersync_url"`
	Disabled         bool   `mapstructure:"disabled"`
	ExtraAdapterInfo string `mapstructure:"extra_info"`

	// needed for Rubicon
	XAPI AdapterXAPI `mapstructure:"xapi"`

	// needed for Facebook
	PlatformID string `mapstructure:"platform_id"`
	AppSecret  string `mapstructure:"app_secret"`
}

type AdapterXAPI

type AdapterXAPI struct {
	Username string `mapstructure:"username"`
	Password string `mapstructure:"password"`
	Tracker  string `mapstructure:"tracker"`
}

type Analytics

type Analytics struct {
	File     FileLogs `mapstructure:"file"`
	Pubstack Pubstack `mapstructure:"pubstack"`
}

type AuctionTimeouts

type AuctionTimeouts struct {
	// The default timeout is used if the user's request didn't define one. Use 0 if there's no default.
	Default uint64 `mapstructure:"default"`
	// The max timeout is used as an absolute cap, to prevent excessively long ones. Use 0 for no cap
	Max uint64 `mapstructure:"max"`
}

func (*AuctionTimeouts) LimitAuctionTimeout

func (cfg *AuctionTimeouts) LimitAuctionTimeout(requested time.Duration) time.Duration

LimitAuctionTimeout returns the min of requested or cfg.MaxAuctionTimeout. Both values treat "0" as "infinite".

type BidderInfo

type BidderInfo struct {
	Enabled                 bool              // copied from adapter config for convenience. to be refactored.
	Maintainer              *MaintainerInfo   `yaml:"maintainer"`
	Capabilities            *CapabilitiesInfo `yaml:"capabilities"`
	ModifyingVastXmlAllowed bool              `yaml:"modifyingVastXmlAllowed"`
	Debug                   *DebugInfo        `yaml:"debug,omitempty"`
	GVLVendorID             uint16            `yaml:"gvlVendorID,omitempty"`
}

BidderInfo is the maintainer information, supported auction types, and feature opts-in for a bidder.

type BidderInfos

type BidderInfos map[string]BidderInfo

BidderInfos contains a mapping of bidder name to bidder info.

func LoadBidderInfoFromDisk

func LoadBidderInfoFromDisk(path string, adapterConfigs map[string]Adapter, bidders []string) (BidderInfos, error)

LoadBidderInfoFromDisk parses all static/bidder-info/{bidder}.yaml files from the file system.

func (BidderInfos) ToGVLVendorIDMap

func (infos BidderInfos) ToGVLVendorIDMap() map[openrtb_ext.BidderName]uint16

ToGVLVendorIDMap transforms a BidderInfos object to a map of bidder names to GVL id. Disabled bidders are omitted from the result.

type CCPA

type CCPA struct {
	Enforce bool `mapstructure:"enforce"`
}

type Cache

type Cache struct {
	Scheme string `mapstructure:"scheme"`
	Host   string `mapstructure:"host"`
	Query  string `mapstructure:"query"`

	// A static timeout here is not ideal. This is a hack because we have some aggressive timelines for OpenRTB support.
	// This value specifies how much time the prebid server host expects a call to prebid cache to take.
	//
	// OpenRTB allows the caller to specify the auction timeout. Prebid Server will subtract _this_ amount of time
	// from the timeout it gives demand sources to respond.
	//
	// In reality, the cache response time will probably fluctuate with the traffic over time. Someday,
	// this should be replaced by code which tracks the response time of recent cache calls and
	// adjusts the time dynamically.
	ExpectedTimeMillis int `mapstructure:"expected_millis"`

	DefaultTTLs DefaultTTLs `mapstructure:"default_ttl_seconds"`
}

Cache configures the url used internally by Prebid Server to communicate with Prebid Cache.

func (*Cache) GetBaseURL

func (cfg *Cache) GetBaseURL() string

Allows for protocol relative URL if scheme is empty

type CacheEventsConfig

type CacheEventsConfig struct {
	// Enabled should be true to enable the events api endpoint
	Enabled bool `mapstructure:"enabled"`
	// Endpoint is the url path exposed for this stored requests events api
	Endpoint string `mapstructure:"endpoint"`
}

CacheEventsConfig configured stored_requests/events/api/api.go

type CapabilitiesInfo

type CapabilitiesInfo struct {
	App  *PlatformInfo `yaml:"app"`
	Site *PlatformInfo `yaml:"site"`
}

CapabilitiesInfo is the supported platforms for a bidder.

type Configuration

type Configuration struct {
	ExternalURL string     `mapstructure:"external_url"`
	Host        string     `mapstructure:"host"`
	Port        int        `mapstructure:"port"`
	Client      HTTPClient `mapstructure:"http_client"`
	CacheClient HTTPClient `mapstructure:"http_client_cache"`
	AdminPort   int        `mapstructure:"admin_port"`
	EnableGzip  bool       `mapstructure:"enable_gzip"`
	// StatusResponse is the string which will be returned by the /status endpoint when things are OK.
	// If empty, it will return a 204 with no content.
	StatusResponse    string          `mapstructure:"status_response"`
	AuctionTimeouts   AuctionTimeouts `mapstructure:"auction_timeouts_ms"`
	CacheURL          Cache           `mapstructure:"cache"`
	ExtCacheURL       ExternalCache   `mapstructure:"external_cache"`
	RecaptchaSecret   string          `mapstructure:"recaptcha_secret"`
	HostCookie        HostCookie      `mapstructure:"host_cookie"`
	Metrics           Metrics         `mapstructure:"metrics"`
	DataCache         DataCache       `mapstructure:"datacache"`
	StoredRequests    StoredRequests  `mapstructure:"stored_requests"`
	StoredRequestsAMP StoredRequests  `mapstructure:"stored_amp_req"`
	CategoryMapping   StoredRequests  `mapstructure:"category_mapping"`
	VTrack            VTrack          `mapstructure:"vtrack"`
	Event             Event           `mapstructure:"event"`
	Accounts          StoredRequests  `mapstructure:"accounts"`
	// Note that StoredVideo refers to stored video requests, and has nothing to do with caching video creatives.
	StoredVideo StoredRequests `mapstructure:"stored_video_req"`

	// Adapters should have a key for every openrtb_ext.BidderName, converted to lower-case.
	// Se also: https://github.com/spf13/viper/issues/371#issuecomment-335388559
	Adapters             map[string]Adapter `mapstructure:"adapters"`
	MaxRequestSize       int64              `mapstructure:"max_request_size"`
	Analytics            Analytics          `mapstructure:"analytics"`
	AMPTimeoutAdjustment int64              `mapstructure:"amp_timeout_adjustment_ms"`
	GDPR                 GDPR               `mapstructure:"gdpr"`
	CCPA                 CCPA               `mapstructure:"ccpa"`
	LMT                  LMT                `mapstructure:"lmt"`
	CurrencyConverter    CurrencyConverter  `mapstructure:"currency_converter"`
	DefReqConfig         DefReqConfig       `mapstructure:"default_request"`

	VideoStoredRequestRequired bool `mapstructure:"video_stored_request_required"`

	// Array of blacklisted apps that is used to create the hash table BlacklistedAppMap so App.ID's can be instantly accessed.
	BlacklistedApps   []string `mapstructure:"blacklisted_apps,flow"`
	BlacklistedAppMap map[string]bool
	// Array of blacklisted accounts that is used to create the hash table BlacklistedAcctMap so Account.ID's can be instantly accessed.
	BlacklistedAccts   []string `mapstructure:"blacklisted_accts,flow"`
	BlacklistedAcctMap map[string]bool
	// Is publisher/account ID required to be submitted in the OpenRTB2 request
	AccountRequired bool `mapstructure:"account_required"`
	// AccountDefaults defines default settings for valid accounts that are partially defined
	// and provides a way to set global settings that can be overridden at account level.
	AccountDefaults Account `mapstructure:"account_defaults"`

	// Local private file containing SSL certificates
	PemCertsFile string `mapstructure:"certificates_file"`
	// Custom headers to handle request timeouts from queueing infrastructure
	RequestTimeoutHeaders RequestTimeoutHeaders `mapstructure:"request_timeout_headers"`
	// Debug/logging flags go here
	Debug Debug `mapstructure:"debug"`
	// RequestValidation specifies the request validation options.
	RequestValidation RequestValidation `mapstructure:"request_validation"`
	// When true, PBS will assign a randomly generated UUID to req.Source.TID if it is empty
	AutoGenSourceTID bool `mapstructure:"auto_gen_source_tid"`
	//When true, new bid id will be generated in seatbid[].bid[].ext.prebid.bidid and used in event urls instead
	GenerateBidID bool `mapstructure:"generate_bid_id"`
	// contains filtered or unexported fields
}

Configuration specifies the static application config.

func New

func New(v *viper.Viper) (*Configuration, error)

New uses viper to get our server configurations.

func (*Configuration) AccountDefaultsJSON

func (cfg *Configuration) AccountDefaultsJSON() json.RawMessage

AccountDefaultsJSON returns the precompiled JSON form of account_defaults

func (*Configuration) GetCachedAssetURL

func (cfg *Configuration) GetCachedAssetURL(uuid string) string

func (*Configuration) MarshalAccountDefaults

func (cfg *Configuration) MarshalAccountDefaults() error

MarshalAccountDefaults compiles AccountDefaults into the JSON format used for merge patch

type Cookie struct {
	Name  string `mapstructure:"name"`
	Value string `mapstructure:"value"`
}

type CurrencyConverter

type CurrencyConverter struct {
	FetchURL             string `mapstructure:"fetch_url"`
	FetchIntervalSeconds int    `mapstructure:"fetch_interval_seconds"`
	StaleRatesSeconds    int    `mapstructure:"stale_rates_seconds"`
}

type DataCache

type DataCache struct {
	Type       string `mapstructure:"type"`
	Filename   string `mapstructure:"filename"`
	CacheSize  int    `mapstructure:"cache_size"`
	TTLSeconds int    `mapstructure:"ttl_seconds"`
}

type DataType

type DataType string

DataType constants

const (
	RequestDataType    DataType = "Request"
	CategoryDataType   DataType = "Category"
	VideoDataType      DataType = "Video"
	AMPRequestDataType DataType = "AMP Request"
	AccountDataType    DataType = "Account"
)

func (DataType) Section

func (dataType DataType) Section() string

Section returns the config section this type is defined in

type Debug

type Debug struct {
	TimeoutNotification TimeoutNotification `mapstructure:"timeout_notification"`
	OverrideToken       string              `mapstructure:"override_token"`
}

type DebugInfo

type DebugInfo struct {
	Allow bool `yaml:"allow"`
}

DebugInfo is the supported debug options for a bidder.

type DefReqConfig

type DefReqConfig struct {
	Type       string      `mapstructure:"type"`
	FileSystem DefReqFiles `mapstructure:"file"`
	AliasInfo  bool        `mapstructure:"alias_info"`
}

AliasConfig will define the various source(s) or the default aliases Currently only filesystem is supported, but keeping the config structure

type DefReqFiles

type DefReqFiles struct {
	FileName string `mapstructure:"name"`
}

type DefaultTTLs

type DefaultTTLs struct {
	Banner int `mapstructure:"banner"`
	Video  int `mapstructure:"video"`
	Native int `mapstructure:"native"`
	Audio  int `mapstructure:"audio"`
}

Default TTLs to use to cache bids for different types of imps.

type DisabledMetrics

type DisabledMetrics struct {
	// True if we want to stop collecting account-to-adapter metrics
	AccountAdapterDetails bool `mapstructure:"account_adapter_details"`

	// True if we don't want to collect metrics about the connections prebid
	// server establishes with bidder servers such as the number of connections
	// that were created or reused.
	AdapterConnectionMetrics bool `mapstructure:"adapter_connections_metrics"`

	// True if we don't want to collect the per adapter GDPR request blocked metric
	AdapterGDPRRequestBlocked bool `mapstructure:"adapter_gdpr_request_blocked"`
}

type Event

type Event struct {
	TimeoutMS int64 `mapstructure:"timeout_ms"`
}

type ExternalCache

type ExternalCache struct {
	Scheme string `mapstructure:"scheme"`
	Host   string `mapstructure:"host"`
	Path   string `mapstructure:"path"`
}

ExternalCache configures the externally accessible cache url.

type FileFetcherConfig

type FileFetcherConfig struct {
	// Enabled should be true if Stored Requests should be loaded from the filesystem.
	Enabled bool `mapstructure:"enabled"`
	// Path to the directory this file fetcher gets data from.
	Path string `mapstructure:"directorypath"`
}

FileFetcherConfig configures a stored_requests/backends/file_fetcher/fetcher.go

type FileLogs

type FileLogs struct {
	Filename string `mapstructure:"filename"`
}

FileLogs Corresponding config for FileLogger as a PBS Analytics Module

type GDPR

type GDPR struct {
	Enabled                 bool         `mapstructure:"enabled"`
	HostVendorID            int          `mapstructure:"host_vendor_id"`
	DefaultValue            string       `mapstructure:"default_value"`
	Timeouts                GDPRTimeouts `mapstructure:"timeouts_ms"`
	NonStandardPublishers   []string     `mapstructure:"non_standard_publishers,flow"`
	NonStandardPublisherMap map[string]struct{}
	TCF2                    TCF2 `mapstructure:"tcf2"`
	AMPException            bool `mapstructure:"amp_exception"` // Deprecated: Use account-level GDPR settings (gdpr.integration_enabled.amp) instead
	// EEACountries (EEA = European Economic Area) are a list of countries where we should assume GDPR applies.
	// If the gdpr flag is unset in a request, but geo.country is set, we will assume GDPR applies if and only
	// if the country matches one on this list. If both the GDPR flag and country are not set, we default
	// to DefaultValue
	EEACountries    []string `mapstructure:"eea_countries"`
	EEACountriesMap map[string]struct{}
}

type GDPRTimeouts

type GDPRTimeouts struct {
	InitVendorlistFetch   int `mapstructure:"init_vendorlist_fetches"`
	ActiveVendorlistFetch int `mapstructure:"active_vendorlist_fetch"`
}

func (*GDPRTimeouts) ActiveTimeout

func (t *GDPRTimeouts) ActiveTimeout() time.Duration

func (*GDPRTimeouts) InitTimeout

func (t *GDPRTimeouts) InitTimeout() time.Duration

type HTTPClient

type HTTPClient struct {
	MaxConnsPerHost     int `mapstructure:"max_connections_per_host"`
	MaxIdleConns        int `mapstructure:"max_idle_connections"`
	MaxIdleConnsPerHost int `mapstructure:"max_idle_connections_per_host"`
	IdleConnTimeout     int `mapstructure:"idle_connection_timeout_seconds"`
}

type HTTPEventsConfig

type HTTPEventsConfig struct {
	Endpoint    string `mapstructure:"endpoint"`
	RefreshRate int64  `mapstructure:"refresh_rate_seconds"`
	Timeout     int    `mapstructure:"timeout_ms"`
	AmpEndpoint string `mapstructure:"amp_endpoint"`
}

HTTPEventsConfig configures stored_requests/events/http/http.go

func (HTTPEventsConfig) RefreshRateDuration

func (cfg HTTPEventsConfig) RefreshRateDuration() time.Duration

func (HTTPEventsConfig) TimeoutDuration

func (cfg HTTPEventsConfig) TimeoutDuration() time.Duration

type HTTPFetcherConfig

type HTTPFetcherConfig struct {
	Endpoint    string `mapstructure:"endpoint"`
	AmpEndpoint string `mapstructure:"amp_endpoint"`
}

HTTPFetcherConfig configures a stored_requests/backends/http_fetcher/fetcher.go

type HostCookie

type HostCookie struct {
	Domain             string `mapstructure:"domain"`
	Family             string `mapstructure:"family"`
	CookieName         string `mapstructure:"cookie_name"`
	OptOutURL          string `mapstructure:"opt_out_url"`
	OptInURL           string `mapstructure:"opt_in_url"`
	MaxCookieSizeBytes int    `mapstructure:"max_cookie_size_bytes"`
	OptOutCookie       Cookie `mapstructure:"optout_cookie"`
	// Cookie timeout in days
	TTL int64 `mapstructure:"ttl_days"`
}

func (*HostCookie) TTLDuration

func (cfg *HostCookie) TTLDuration() time.Duration

type InMemoryCache

type InMemoryCache struct {
	// Identify the type of memory cache. "none", "unbounded", "lru"
	Type string `mapstructure:"type"`
	// TTL is the maximum number of seconds that an unused value will stay in the cache.
	// TTL <= 0 can be used for "no ttl". Elements will still be evicted based on the Size.
	TTL int `mapstructure:"ttl_seconds"`
	// Size is the max total cache size allowed for single caches
	Size int `mapstructure:"size_bytes"`
	// RequestCacheSize is the max number of bytes allowed in the cache for Stored Requests. Values <= 0 will have no limit
	RequestCacheSize int `mapstructure:"request_cache_size_bytes"`
	// ImpCacheSize is the max number of bytes allowed in the cache for Stored Imps. Values <= 0 will have no limit
	ImpCacheSize int `mapstructure:"imp_cache_size_bytes"`
}

type InfluxMetrics

type InfluxMetrics struct {
	Host               string `mapstructure:"host"`
	Database           string `mapstructure:"database"`
	Username           string `mapstructure:"username"`
	Password           string `mapstructure:"password"`
	MetricSendInterval int    `mapstructure:"metric_send_interval"`
}

type IntegrationType

type IntegrationType string

IntegrationType enumerates the values of integrations Prebid Server can configure for an account

const (
	IntegrationTypeAMP   IntegrationType = "amp"
	IntegrationTypeApp   IntegrationType = "app"
	IntegrationTypeVideo IntegrationType = "video"
	IntegrationTypeWeb   IntegrationType = "web"
)

Possible values of integration types Prebid Server can configure for an account

type InterstitialSize

type InterstitialSize struct {
	Width  uint64
	Height uint64
}

InterstitialSize represents the width and height of an interstitial ad.

type LMT

type LMT struct {
	Enforce bool `mapstructure:"enforce"`
}

type MaintainerInfo

type MaintainerInfo struct {
	Email string `yaml:"email"`
}

MaintainerInfo is the support email address for a bidder.

type Metrics

type Metrics struct {
	Influxdb   InfluxMetrics     `mapstructure:"influxdb"`
	Prometheus PrometheusMetrics `mapstructure:"prometheus"`
	Disabled   DisabledMetrics   `mapstructure:"disabled_metrics"`
}

type PlatformInfo

type PlatformInfo struct {
	MediaTypes []openrtb_ext.BidType `yaml:"mediaTypes"`
}

PlatformInfo is the supported media types for a bidder.

type PostgresCacheInitializer

type PostgresCacheInitializer struct {
	Timeout int `mapstructure:"timeout_ms"`
	// Query should be something like:
	//
	// SELECT id, requestData, 'request' AS type FROM stored_requests
	// UNION ALL
	// SELECT id, impData, 'imp' AS type FROM stored_imps
	//
	// This query will be run once on startup to fetch _all_ known Stored Request data from the database.
	//
	// For more details on the expected format of requestData and impData, see stored_requests/events/postgres/polling.go
	Query string `mapstructure:"query"`
	// AmpQuery is just like Query, but for AMP Stored Requests
	AmpQuery string `mapstructure:"amp_query"`
}

type PostgresConfig

type PostgresConfig struct {
	ConnectionInfo      PostgresConnection       `mapstructure:"connection"`
	FetcherQueries      PostgresFetcherQueries   `mapstructure:"fetcher"`
	CacheInitialization PostgresCacheInitializer `mapstructure:"initialize_caches"`
	PollUpdates         PostgresUpdatePolling    `mapstructure:"poll_for_updates"`
}

PostgresConfig configures the Stored Request ecosystem to use Postgres. This must include a Fetcher, and may optionally include some EventProducers to populate and refresh the caches.

type PostgresConnection

type PostgresConnection struct {
	Database string `mapstructure:"dbname"`
	Host     string `mapstructure:"host"`
	Port     int    `mapstructure:"port"`
	Username string `mapstructure:"user"`
	Password string `mapstructure:"password"`
}

PostgresConnection has options which put types to the Postgres Connection string. See: https://godoc.org/github.com/lib/pq#hdr-Connection_String_Parameters

func (*PostgresConnection) ConnString

func (cfg *PostgresConnection) ConnString() string

type PostgresFetcherQueries

type PostgresFetcherQueries struct {
	// QueryTemplate is the Postgres Query which can be used to fetch configs from the database.
	// It is a Template, rather than a full Query, because a single HTTP request may reference multiple Stored Requests.
	//
	// In the simplest case, this could be something like:
	//   SELECT id, requestData, 'request' as type
	//     FROM stored_requests
	//     WHERE id in %REQUEST_ID_LIST%
	//     UNION ALL
	//   SELECT id, impData, 'imp' as type
	//     FROM stored_imps
	//     WHERE id in %IMP_ID_LIST%
	//
	// The MakeQuery function will transform this query into:
	//   SELECT id, requestData, 'request' as type
	//     FROM stored_requests
	//     WHERE id in ($1)
	//     UNION ALL
	//   SELECT id, impData, 'imp' as type
	//     FROM stored_imps
	//     WHERE id in ($2, $3, $4, ...)
	//
	// ... where the number of "$x" args depends on how many IDs are nested within the HTTP request.
	QueryTemplate string `mapstructure:"query"`

	// AmpQueryTemplate is the same as QueryTemplate, but used in the `/openrtb2/amp` endpoint.
	AmpQueryTemplate string `mapstructure:"amp_query"`
}

func (*PostgresFetcherQueries) MakeQuery

func (cfg *PostgresFetcherQueries) MakeQuery(numReqs int, numImps int) (query string)

MakeQuery builds a query which can fetch numReqs Stored Requests and numImps Stored Imps. See the docs on PostgresConfig.QueryTemplate for a description of how it works.

type PostgresUpdatePolling

type PostgresUpdatePolling struct {
	// RefreshRate determines how frequently the Query and AmpQuery are run.
	RefreshRate int `mapstructure:"refresh_rate_seconds"`

	// Timeout is the amount of time before a call to the database is aborted.
	Timeout int `mapstructure:"timeout_ms"`

	// An example UpdateQuery is:
	//
	// SELECT id, requestData, 'request' AS type
	//   FROM stored_requests
	//   WHERE last_updated > $1
	// UNION ALL
	// SELECT id, requestData, 'imp' AS type
	//   FROM stored_imps
	//   WHERE last_updated > $1
	//
	// The code will be run periodically to fetch updates from the database.
	Query string `mapstructure:"query"`
	// AmpQuery is the same as Query, but used for the `/openrtb2/amp` endpoint.
	AmpQuery string `mapstructure:"amp_query"`
}

type Privacy

type Privacy struct {
	CCPA CCPA
	GDPR GDPR
	LMT  LMT
}

Privacy is a grouping of privacy related configs to assist in dependency injection.

type PrometheusMetrics

type PrometheusMetrics struct {
	Port             int    `mapstructure:"port"`
	Namespace        string `mapstructure:"namespace"`
	Subsystem        string `mapstructure:"subsystem"`
	TimeoutMillisRaw int    `mapstructure:"timeout_ms"`
}

func (*PrometheusMetrics) Timeout

func (m *PrometheusMetrics) Timeout() time.Duration

type Pubstack

type Pubstack struct {
	Enabled     bool           `mapstructure:"enabled"`
	ScopeId     string         `mapstructure:"scopeid"`
	IntakeUrl   string         `mapstructure:"endpoint"`
	Buffers     PubstackBuffer `mapstructure:"buffers"`
	ConfRefresh string         `mapstructure:"configuration_refresh_delay"`
}

type PubstackBuffer

type PubstackBuffer struct {
	BufferSize string `mapstructure:"size"`
	EventCount int    `mapstructure:"count"`
	Timeout    string `mapstructure:"timeout"`
}

type PurposeDetail

type PurposeDetail struct {
	Enabled bool `mapstructure:"enabled"`
}

Making a purpose struct so purpose specific details can be added later.

type PurposeOneTreatment added in v0.164.0

type PurposeOneTreatment struct {
	Enabled       bool `mapstructure:"enabled"`
	AccessAllowed bool `mapstructure:"access_allowed"`
}

type RequestTimeoutHeaders

type RequestTimeoutHeaders struct {
	RequestTimeInQueue    string `mapstructure:"request_time_in_queue"`
	RequestTimeoutInQueue string `mapstructure:"request_timeout_in_queue"`
}

type RequestValidation

type RequestValidation struct {
	IPv4PrivateNetworks       []string `mapstructure:"ipv4_private_networks,flow"`
	IPv4PrivateNetworksParsed []net.IPNet

	IPv6PrivateNetworks       []string `mapstructure:"ipv6_private_networks,flow"`
	IPv6PrivateNetworksParsed []net.IPNet
}

RequestValidation specifies the request validation options.

func (*RequestValidation) Parse

func (r *RequestValidation) Parse() error

Parse converts the CIDR representation of the IPv4 and IPv6 private networks as net.IPNet structs, or returns an error if at least one is invalid.

type StoredRequests

type StoredRequests struct {

	// Files should be used if Stored Requests should be loaded from the filesystem.
	// Fetchers are in stored_requests/backends/file_system/fetcher.go
	Files FileFetcherConfig `mapstructure:"filesystem"`
	// Postgres configures Fetchers and EventProducers which read from a Postgres DB.
	// Fetchers are in stored_requests/backends/db_fetcher/postgres.go
	// EventProducers are in stored_requests/events/postgres
	Postgres PostgresConfig `mapstructure:"postgres"`
	// HTTP configures an instance of stored_requests/backends/http/http_fetcher.go.
	// If non-nil, Stored Requests will be fetched from the endpoint described there.
	HTTP HTTPFetcherConfig `mapstructure:"http"`
	// InMemoryCache configures an instance of stored_requests/caches/memory/cache.go.
	// If non-nil, Stored Requests will be saved in an in-memory cache.
	InMemoryCache InMemoryCache `mapstructure:"in_memory_cache"`
	// CacheEvents configures an instance of stored_requests/events/api/api.go.
	// This is a sub-object containing the endpoint name to use for this API endpoint.
	CacheEvents CacheEventsConfig `mapstructure:"cache_events"`
	// HTTPEvents configures an instance of stored_requests/events/http/http.go.
	// If non-nil, the server will use those endpoints to populate and update the cache.
	HTTPEvents HTTPEventsConfig `mapstructure:"http_events"`
	// contains filtered or unexported fields
}

StoredRequests struct defines options for stored requests for each data type including some amp stored_requests options

func (*StoredRequests) DataType

func (sr *StoredRequests) DataType() DataType

DataType returns the DataType associated with this config

func (*StoredRequests) Section

func (sr *StoredRequests) Section() string

Section returns the config section

func (*StoredRequests) SetDataType

func (sr *StoredRequests) SetDataType(dataType DataType)

SetDataType sets the DataType on this config. Needed for tests.

type TCF2

type TCF2 struct {
	Enabled             bool                `mapstructure:"enabled"`
	Purpose1            PurposeDetail       `mapstructure:"purpose1"`
	Purpose2            PurposeDetail       `mapstructure:"purpose2"`
	Purpose7            PurposeDetail       `mapstructure:"purpose7"`
	SpecialPurpose1     PurposeDetail       `mapstructure:"special_purpose1"`
	PurposeOneTreatment PurposeOneTreatment `mapstructure:"purpose_one_treatment"`
}

TCF2 defines the TCF2 specific configurations for GDPR

type TimeoutNotification

type TimeoutNotification struct {
	// Log timeout notifications in the application log
	Log bool `mapstructure:"log"`
	// Fraction of notifications to log
	SamplingRate float32 `mapstructure:"sampling_rate"`
	// Only log failures
	FailOnly bool `mapstructure:"fail_only"`
}

type VTrack

type VTrack struct {
	TimeoutMS          int64 `mapstructure:"timeout_ms"`
	AllowUnknownBidder bool  `mapstructure:"allow_unknown_bidder"`
	Enabled            bool  `mapstructure:"enabled"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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