cmd/stepd: Add config key and arguments for the directory document
This commit is contained in:
		
							parent
							
								
									70a1194bca
								
							
						
					
					
						commit
						dc378008d6
					
				@ -31,7 +31,11 @@ func main () {
 | 
			
		||||
		":8080", cli.ValString)
 | 
			
		||||
	flagHTTPErrorDocument := cli.NewInputFlag (
 | 
			
		||||
		0, "http-error-document",
 | 
			
		||||
		"The document to use for displaying http errors.",
 | 
			
		||||
		"The document to use for displaying errors over http.",
 | 
			
		||||
		"", cli.ValString)
 | 
			
		||||
	flagHTTPDirectoryDocument := cli.NewInputFlag (
 | 
			
		||||
		0, "http-directory-document",
 | 
			
		||||
		"The document to use for displaying directory listings over http.",
 | 
			
		||||
		"", cli.ValString)
 | 
			
		||||
	flagDirectories := cli.NewFlag (
 | 
			
		||||
		'd', "directories",
 | 
			
		||||
@ -41,6 +45,7 @@ func main () {
 | 
			
		||||
		flagPidFile,
 | 
			
		||||
		flagHTTPAddress,
 | 
			
		||||
		flagHTTPErrorDocument,
 | 
			
		||||
		flagHTTPDirectoryDocument,
 | 
			
		||||
		flagDirectories,
 | 
			
		||||
		cli.NewHelp())
 | 
			
		||||
	cmd.Syntax = "[OPTIONS]... [DIRECTORY]"
 | 
			
		||||
@ -111,12 +116,13 @@ func main () {
 | 
			
		||||
 | 
			
		||||
	// set up the HTTP handler
 | 
			
		||||
	handler := stephttp.Handler {
 | 
			
		||||
		Environment:   &environment,
 | 
			
		||||
		Directories:   config.Get("http.serve-directories") == "true",
 | 
			
		||||
		StepExt:       ucontainer.NewSet(slices.Clone(config["http.step-extension"])...),
 | 
			
		||||
		Index:         slices.Clone(config["http.index-file"]),
 | 
			
		||||
		ErrorDocument: config.Get("http.error-document"),
 | 
			
		||||
		DenyAll:       ucontainer.NewSet(configFileName),
 | 
			
		||||
		Environment:       &environment,
 | 
			
		||||
		Directories:       config.Get("http.serve-directories") == "true",
 | 
			
		||||
		StepExt:           ucontainer.NewSet(slices.Clone(config["http.step-extension"])...),
 | 
			
		||||
		Index:             slices.Clone(config["http.index-file"]),
 | 
			
		||||
		ErrorDocument:     config.Get("http.error-document"),
 | 
			
		||||
		DirectoryDocument: config.Get("http.directory-document"),
 | 
			
		||||
		DenyAll:           ucontainer.NewSet(configFileName),
 | 
			
		||||
	}
 | 
			
		||||
	if len(handler.StepExt) == 0 {
 | 
			
		||||
		handler.StepExt.Add(".step")
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user