|
|
|
@ -21,13 +21,18 @@ func setup() {
|
|
|
|
|
footer = buildFooter(*footerText)
|
|
|
|
|
gophermapRegex = compileGophermapRegex()
|
|
|
|
|
|
|
|
|
|
// Generate capability files
|
|
|
|
|
capsTxt := generateCapsTxt(*desc, *admin, *geo)
|
|
|
|
|
robotsTxt := generateRobotsTxt()
|
|
|
|
|
// Add generated files to cache if not present
|
|
|
|
|
p := core.NewPath(core.Root, "caps.txt")
|
|
|
|
|
if _, err := core.FileSystem.StatFile(p); err != nil {
|
|
|
|
|
core.SystemLog.Info("Policy file %s not found! Generating...", p.Absolute())
|
|
|
|
|
core.FileSystem.AddGeneratedFile(p, generateCapsTxt(*desc, *admin, *geo))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Add generated files to cache
|
|
|
|
|
core.FileSystem.AddGeneratedFile(core.NewPath(core.Root, "caps.txt"), capsTxt)
|
|
|
|
|
core.FileSystem.AddGeneratedFile(core.NewPath(core.Root, "robots.txt"), robotsTxt)
|
|
|
|
|
p = core.NewPath(core.Root, "robots.txt")
|
|
|
|
|
if _, err := core.FileSystem.StatFile(p); err != nil {
|
|
|
|
|
core.SystemLog.Info("Policy file %s not found! Generating...", p.Absolute())
|
|
|
|
|
core.FileSystem.AddGeneratedFile(p, generateRobotsTxt())
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Run does as says :)
|
|
|
|
|