package main import ( "strings" "path" ) type Conf struct { Http HttpConf `ini:"http"` Repo RepoConf `ini:"repo"` PGP PGPConf `ini:"pgp"` } type HttpConf struct { Port int `ini:"port"` Key string `ini:"key"` SSL bool `ini:"ssl"` SSLCert string `ini:"cert"` SSLKey string `ini:"key"` EnableVhosts bool `ini:"vhosts"` } type RepoConf struct { Root string `ini:"root"` Distros string `ini:"distros"` Architectures string `ini:"architectures"` } type PGPConf struct { Key string `ini:"key"` Passphrase string `ini:"passphrase"` } func (c Conf) DistPath(distro string) string { return path.Join(c.Repo.Root, "dists", distro) } func (c Conf) ArchPath(distro, arch string) string { return path.Join(c.Repo.Root, "dists", distro, "main/binary-"+arch) } func (c Conf) PoolPath(distro, arch string) string { return path.Join(c.Repo.Root, "pool/main", distro, arch) } func (c Conf) PoolPackagePath(distro, arch, name string) string { return path.Join(c.Repo.Root, c.RelativePoolPackagePath(distro, arch, name)) } func (c Conf) RelativePoolPackagePath(distro, arch, name string) string { name = packageName(name) return path.Join("pool/main", distro, arch, name[0:1], name) } func (c RepoConf) DistroNames() []string { return strings.Split(c.Distros, ",") } func (c RepoConf) ArchitectureNames() []string { return strings.Split(c.Architectures, ",") }