github.com/gogf/gf/v2@v2.7.4/net/ghttp/ghttp_server_config_mess.go (about)

     1  // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
     2  //
     3  // This Source Code Form is subject to the terms of the MIT License.
     4  // If a copy of the MIT was not distributed with this file,
     5  // You can obtain one at https://github.com/gogf/gf.
     6  
     7  package ghttp
     8  
     9  // SetNameToUriType sets the NameToUriType for server.
    10  func (s *Server) SetNameToUriType(t int) {
    11  	s.config.NameToUriType = t
    12  }
    13  
    14  // SetDumpRouterMap sets the DumpRouterMap for server.
    15  // If DumpRouterMap is enabled, it automatically dumps the route map when server starts.
    16  func (s *Server) SetDumpRouterMap(enabled bool) {
    17  	s.config.DumpRouterMap = enabled
    18  }
    19  
    20  // SetClientMaxBodySize sets the ClientMaxBodySize for server.
    21  func (s *Server) SetClientMaxBodySize(maxSize int64) {
    22  	s.config.ClientMaxBodySize = maxSize
    23  }
    24  
    25  // SetFormParsingMemory sets the FormParsingMemory for server.
    26  func (s *Server) SetFormParsingMemory(maxMemory int64) {
    27  	s.config.FormParsingMemory = maxMemory
    28  }
    29  
    30  // SetGraceful sets the Graceful for server.
    31  func (s *Server) SetGraceful(graceful bool) {
    32  	s.config.Graceful = graceful
    33  	// note: global setting.
    34  	gracefulEnabled = graceful
    35  }
    36  
    37  // GetGraceful returns the Graceful for server.
    38  func (s *Server) GetGraceful() bool {
    39  	return s.config.Graceful
    40  }
    41  
    42  // SetGracefulTimeout sets the GracefulTimeout for server.
    43  func (s *Server) SetGracefulTimeout(gracefulTimeout int) {
    44  	s.config.GracefulTimeout = gracefulTimeout
    45  }
    46  
    47  // GetGracefulTimeout returns the GracefulTimeout for server.
    48  func (s *Server) GetGracefulTimeout() int {
    49  	return s.config.GracefulTimeout
    50  }
    51  
    52  // SetGracefulShutdownTimeout sets the GracefulShutdownTimeout for server.
    53  func (s *Server) SetGracefulShutdownTimeout(gracefulShutdownTimeout int) {
    54  	s.config.GracefulShutdownTimeout = gracefulShutdownTimeout
    55  }
    56  
    57  // GetGracefulShutdownTimeout returns the GracefulShutdownTimeout for server.
    58  func (s *Server) GetGracefulShutdownTimeout() int {
    59  	return s.config.GracefulShutdownTimeout
    60  }