2022-07-11 21:47:22 +01:00
package conf
import "golang.captainalm.com/GOPackageHeaderServer/outputMeta"
type ZoneYaml struct {
2022-07-12 15:41:50 +01:00
Name string ` yaml:"name" `
Domains [ ] string ` yaml:"domains" `
CssURL string ` yaml:"cssURL" `
HavePageContents bool ` yaml:"havePageContents" `
BasePath string ` yaml:"basePath" `
2022-07-14 21:58:11 +01:00
UsernameProvided bool ` yaml:"usernameProvided" ` //If set, the outputter will do /{user}/{repo}/ for repos rather than /{repo}/ ; Should really be named usernameProvidedByRequest
2022-07-12 15:41:50 +01:00
Username string ` yaml:"username" `
BasePrefixURL string ` yaml:"basePrefixURL" `
SuffixDirectoryURL string ` yaml:"suffixDirectoryURL" `
SuffixFileURL string ` yaml:"suffixFileURL" `
RangeSupported bool ` yaml:"rangeSupported" `
2022-07-14 21:58:11 +01:00
PathLengthLimit uint ` yaml:"pathLengthLimit" ` //The length of the path (Number of entries in the path) to return in the responses; (If 0: defaults to 1, if the username is not expected to be provided by the request, otherwise defaulting to 2)
2022-07-12 15:41:50 +01:00
CacheSettings CacheSettingsYaml ` yaml:"cacheSettings" `
2022-07-11 21:47:22 +01:00
}
func ( zy ZoneYaml ) GetPackageMetaTagOutputter ( ) * outputMeta . PackageMetaTagOutputter {
var theUsername string
if ! zy . UsernameProvided {
theUsername = zy . Username
}
2022-07-14 21:58:11 +01:00
pthLength := zy . PathLengthLimit
if pthLength == 0 {
if zy . UsernameProvided {
pthLength = 2
} else {
pthLength = 1
}
}
2022-07-11 21:47:22 +01:00
return & outputMeta . PackageMetaTagOutputter {
BasePath : zy . BasePath ,
Username : theUsername ,
BasePrefixURL : zy . BasePrefixURL ,
SuffixDirectoryURL : zy . SuffixDirectoryURL ,
SuffixFileURL : zy . SuffixFileURL ,
2022-07-14 21:58:11 +01:00
PathLengthLimit : pthLength ,
2022-07-11 21:47:22 +01:00
}
}