prefix url as a flag
Former-commit-id: 837bddec0e006860889cebfa74e476aab7f1b04f [formerly 681933b995c0d65da501270f677c6dec358da62d] [formerly 7db51254915e0eeaf7e7098fb5ee79425aae9514 [formerly 3fde3c716bc37dd95730bd52004393cfa57d4a84]] Former-commit-id: 45535dfac3fbb2cf605d107bcb1887bfc3809cf2 [formerly ee5d2e0d7df8606566988854b0de22303a32748d] Former-commit-id: 51378e5b5a6325938d00416c200053f772ca0b61
This commit is contained in:
		
							parent
							
								
									40fe081962
								
							
						
					
					
						commit
						4f7e6cbb52
					
				| 
						 | 
				
			
			@ -33,6 +33,7 @@ var (
 | 
			
		|||
	staticg       string
 | 
			
		||||
	locale        string
 | 
			
		||||
	baseurl       string
 | 
			
		||||
	prefixurl     string
 | 
			
		||||
	port          int
 | 
			
		||||
	noAuth        bool
 | 
			
		||||
	allowCommands bool
 | 
			
		||||
| 
						 | 
				
			
			@ -52,6 +53,7 @@ func init() {
 | 
			
		|||
	flag.StringVarP(&scope, "scope", "s", ".", "Default scope option for new users")
 | 
			
		||||
	flag.StringVarP(&baseurl, "baseurl", "b", "", "Base URL")
 | 
			
		||||
	flag.StringVar(&commands, "commands", "git svn hg", "Default commands option for new users")
 | 
			
		||||
	flag.StringVarP(&prefixurl, "prefixurl", "p", "", "Prefix URL")
 | 
			
		||||
	flag.BoolVar(&allowCommands, "allow-commands", true, "Default allow commands option for new users")
 | 
			
		||||
	flag.BoolVar(&allowEdit, "allow-edit", true, "Default allow edit option for new users")
 | 
			
		||||
	flag.BoolVar(&allowPublish, "allow-publish", true, "Default allow publish option for new users")
 | 
			
		||||
| 
						 | 
				
			
			@ -77,6 +79,7 @@ func setupViper() {
 | 
			
		|||
	viper.SetDefault("Locale", "en")
 | 
			
		||||
	viper.SetDefault("NoAuth", false)
 | 
			
		||||
	viper.SetDefault("BaseURL", "")
 | 
			
		||||
	viper.SetDefault("PrefixURL", "")
 | 
			
		||||
 | 
			
		||||
	viper.BindPFlag("Port", flag.Lookup("port"))
 | 
			
		||||
	viper.BindPFlag("Address", flag.Lookup("address"))
 | 
			
		||||
| 
						 | 
				
			
			@ -92,6 +95,7 @@ func setupViper() {
 | 
			
		|||
	viper.BindPFlag("StaticGen", flag.Lookup("staticgen"))
 | 
			
		||||
	viper.BindPFlag("NoAuth", flag.Lookup("no-auth"))
 | 
			
		||||
	viper.BindPFlag("BaseURL", flag.Lookup("baseurl"))
 | 
			
		||||
	viper.BindPFlag("PrefixURL", flag.Lookup("prefixurl"))
 | 
			
		||||
 | 
			
		||||
	viper.SetConfigName("filemanager")
 | 
			
		||||
	viper.AddConfigPath(".")
 | 
			
		||||
| 
						 | 
				
			
			@ -182,7 +186,7 @@ func handler() http.Handler {
 | 
			
		|||
	fm := &filemanager.FileManager{
 | 
			
		||||
		NoAuth:    viper.GetBool("NoAuth"),
 | 
			
		||||
		BaseURL:   viper.GetString("BaseURL"),
 | 
			
		||||
		PrefixURL: "",
 | 
			
		||||
		PrefixURL: viper.GetString("PrefixURL"),
 | 
			
		||||
		DefaultUser: &filemanager.User{
 | 
			
		||||
			AllowCommands: viper.GetBool("AllowCommands"),
 | 
			
		||||
			AllowEdit:     viper.GetBool("AllowEdit"),
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue