Add ownerName to config.

Change-Id: I81e39e21f9c76df45fd2bd6f4f6fab02ab28ddbf
This commit is contained in:
Brad Fitzpatrick 2013-06-26 12:55:47 -07:00
parent fd759e2413
commit ffad34ef94
3 changed files with 16 additions and 8 deletions

View File

@ -243,7 +243,7 @@ func addS3Config(prefixes jsonconfig.Obj, s3 string) error {
return nil return nil
} }
func genLowLevelPrefixes(params *configPrefixesParams) (m jsonconfig.Obj) { func genLowLevelPrefixes(params *configPrefixesParams, ownerName string) (m jsonconfig.Obj) {
m = make(jsonconfig.Obj) m = make(jsonconfig.Obj)
haveIndex := params.indexerPath != "" haveIndex := params.indexerPath != ""
@ -254,13 +254,17 @@ func genLowLevelPrefixes(params *configPrefixesParams) (m jsonconfig.Obj) {
pubKeyDest = "/bs-and-index/" pubKeyDest = "/bs-and-index/"
} }
rootArgs := map[string]interface{}{
"stealth": false,
"blobRoot": root,
"statusRoot": "/status/",
}
if ownerName != "" {
rootArgs["ownerName"] = ownerName
}
m["/"] = map[string]interface{}{ m["/"] = map[string]interface{}{
"handler": "root", "handler": "root",
"handlerArgs": map[string]interface{}{ "handlerArgs": rootArgs,
"stealth": false,
"blobRoot": root,
"statusRoot": "/status/",
},
} }
if haveIndex { if haveIndex {
setMap(m, "/", "handlerArgs", "searchRoot", "/my-search/") setMap(m, "/", "handlerArgs", "searchRoot", "/my-search/")
@ -381,6 +385,8 @@ func genLowLevelConfig(conf *Config) (lowLevelConf *Config, err error) {
// sourceRoot + "/server/camlistored/ui" and the closure library at // sourceRoot + "/server/camlistored/ui" and the closure library at
// sourceRoot + "/third_party/closure/lib" // sourceRoot + "/third_party/closure/lib"
sourceRoot = conf.OptionalString("sourceRoot", "") sourceRoot = conf.OptionalString("sourceRoot", "")
ownerName = conf.OptionalString("ownerName", "")
) )
if err := conf.Validate(); err != nil { if err := conf.Validate(); err != nil {
return nil, err return nil, err
@ -464,7 +470,7 @@ func genLowLevelConfig(conf *Config) (lowLevelConf *Config, err error) {
shareHandler: shareHandler, shareHandler: shareHandler,
} }
prefixes := genLowLevelPrefixes(prefixesParams) prefixes := genLowLevelPrefixes(prefixesParams, ownerName)
var cacheDir string var cacheDir string
if nolocaldisk { if nolocaldisk {
// Whether camlistored is run from EC2 or not, we use // Whether camlistored is run from EC2 or not, we use

View File

@ -7,6 +7,7 @@
"handler": "root", "handler": "root",
"handlerArgs": { "handlerArgs": {
"blobRoot": "/bs-and-maybe-also-index/", "blobRoot": "/bs-and-maybe-also-index/",
"ownerName": "Brad",
"searchRoot": "/my-search/", "searchRoot": "/my-search/",
"statusRoot": "/status/", "statusRoot": "/status/",
"stealth": false "stealth": false

View File

@ -9,5 +9,6 @@
"s3": "key:secret:bucket", "s3": "key:secret:bucket",
"replicateTo": [], "replicateTo": [],
"publish": {}, "publish": {},
"ownerName": "Brad",
"shareHandler": true "shareHandler": true
} }