MCPcopy
hub / github.com/benoitc/gunicorn / load_config

Method load_config

gunicorn/app/base.py:154–199  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

152 return self.load_config_from_module_name_or_filename(location=filename)
153
154 def load_config(self):
155 # parse console args
156 parser = self.cfg.parser()
157 args = parser.parse_args()
158
159 # optional settings from apps
160 cfg = self.init(parser, args, args.args)
161
162 # set up import paths and follow symlinks
163 self.chdir()
164
165 # Load up the any app specific configuration
166 if cfg:
167 for k, v in cfg.items():
168 self.cfg.set(k.lower(), v)
169
170 env_args = parser.parse_args(self.cfg.get_cmd_args_from_env())
171
172 if args.config:
173 self.load_config_from_file(args.config)
174 elif env_args.config:
175 self.load_config_from_file(env_args.config)
176 else:
177 default_config = get_default_config_file()
178 if default_config is not None:
179 self.load_config_from_file(default_config)
180
181 # Load up environment configuration
182 for k, v in vars(env_args).items():
183 if v is None:
184 continue
185 if k == "args":
186 continue
187 self.cfg.set(k.lower(), v)
188
189 # Lastly, update the configuration with any command line settings.
190 for k, v in vars(args).items():
191 if v is None:
192 continue
193 if k == "args":
194 continue
195 self.cfg.set(k.lower(), v)
196
197 # current directory might be changed by the config now
198 # set up import paths and follow symlinks
199 self.chdir()
200
201 def run(self):
202 if self.cfg.print_config:

Callers

nothing calls this directly

Calls 8

chdirMethod · 0.95
load_config_from_fileMethod · 0.95
get_default_config_fileFunction · 0.90
parserMethod · 0.80
itemsMethod · 0.80
get_cmd_args_from_envMethod · 0.80
initMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected