forked from prebid/prebid-server
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
26c0619
commit 5cbf91e
Showing
7 changed files
with
102 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package tagbidder | ||
|
||
import ( | ||
"encoding/json" | ||
"io/ioutil" | ||
|
||
"github.com/golang/glog" | ||
) | ||
|
||
//Keys each macro mapping key definition | ||
type Keys struct { | ||
Cached *bool `json:"cached,omitempty"` | ||
Type MacroKeyType `json:"type,omitempty"` | ||
} | ||
|
||
//BidderConfig mapper json | ||
type BidderConfig struct { | ||
URL string `json:"url,omitempty"` | ||
Keys map[string]Keys `json:"keys,omitempty"` | ||
} | ||
|
||
var bidderConfig map[string]*BidderConfig | ||
|
||
//RegisterBidderConfig will be used by each bidder to set its respective macro Mapper | ||
func RegisterBidderConfig(bidder string, config *BidderConfig) { | ||
bidderConfig[bidder] = config | ||
} | ||
|
||
//GetBidderConfig will return Mapper of specific bidder | ||
func GetBidderConfig(bidder string) *BidderConfig { | ||
return bidderConfig[bidder] | ||
} | ||
|
||
//FetchBidderConfig returns new Mapper from JSON details | ||
func FetchBidderConfig(confDir string, bidders []string) { | ||
for _, bidderName := range bidders { | ||
bidderString := string(bidderName) | ||
fileData, err := ioutil.ReadFile(confDir + "/" + bidderString + ".json") | ||
if err != nil { | ||
glog.Fatalf("error reading from file %s: %v", confDir+"/"+bidderString+".json", err) | ||
} | ||
|
||
var bidderConfig BidderConfig | ||
if err := json.Unmarshal([]byte(fileData), &bidderConfig); nil != err { | ||
glog.Fatalf("error parsing json in file %s: %v", confDir+"/"+bidderString+".json", err) | ||
} | ||
|
||
mapper := NewMapperFromConfig(&bidderConfig) | ||
if nil == mapper { | ||
glog.Fatalf("no query parameters mapper for bidder " + bidderString) | ||
} | ||
|
||
RegisterBidderMapper(bidderString, mapper) | ||
RegisterBidderConfig(bidderString, &bidderConfig) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"url": "https://search.spotxchange.com/vast/2.00/%%Channel%%?VPI=MP4&app[bundle]=%%MacroAppBundle%%&app[name]=%%MacroAppName%%&app[cat]=%%MacroCategory%%&app[domain]=%%MacroDomain%%&app[privacypolicy]=%%MacroPrivacyPolicy%%&app[storeurl]=%%MacroAppStoreURL%%&app[ver]=%%MacroAppVersion%%&cb=%%MacroCacheBuster%%&device[devicetype]=%%MacroDeviceType%%&device[ifa]=%%MacroDeviceIFA%%&device[make]=%%MacroMake%%&device[model]=%%MacroModel%%&device[dnt]=%%MacroDNT%%&player_height=%%MacroVideoPlayerHeight%%&player_width=%%MacroVideoPlayerWidth%%&ip_addr=%%MacroIP%%&device[ua]=%%MacroUserAgent%%", | ||
"keys": { | ||
"channel_id": { | ||
"cached": false, | ||
"type": "custom" | ||
}, | ||
"ad_unit": { | ||
"cached": false, | ||
"type": "custom" | ||
}, | ||
"secure": { | ||
"cached": false, | ||
"type": "custom" | ||
}, | ||
"ad_volume": { | ||
"cached": false, | ||
"type": "custom" | ||
}, | ||
"price_floor": { | ||
"cached": false, | ||
"type": "custom" | ||
}, | ||
"hide_skin": { | ||
"cached": false, | ||
"type": "custom" | ||
} | ||
} | ||
} |