mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Allow to modify environment in pre_exec callback
This commit is contained in:
parent
f8e14a53b2
commit
0bd2faa2e7
@ -386,6 +386,8 @@ class Arbiter(object):
|
|||||||
self.master_name = "Old Master"
|
self.master_name = "Old Master"
|
||||||
return
|
return
|
||||||
|
|
||||||
|
self.cfg.pre_exec(self)
|
||||||
|
|
||||||
environ = self.cfg.env_orig.copy()
|
environ = self.cfg.env_orig.copy()
|
||||||
fds = [l.fileno() for l in self.LISTENERS]
|
fds = [l.fileno() for l in self.LISTENERS]
|
||||||
environ['GUNICORN_FD'] = ",".join([str(fd) for fd in fds])
|
environ['GUNICORN_FD'] = ",".join([str(fd) for fd in fds])
|
||||||
@ -394,7 +396,6 @@ class Arbiter(object):
|
|||||||
environ['GUNICORN_LOCK'] = self.LOCK_FILE.name()
|
environ['GUNICORN_LOCK'] = self.LOCK_FILE.name()
|
||||||
|
|
||||||
os.chdir(self.START_CTX['cwd'])
|
os.chdir(self.START_CTX['cwd'])
|
||||||
self.cfg.pre_exec(self)
|
|
||||||
|
|
||||||
# exec the process using the original environnement
|
# exec the process using the original environnement
|
||||||
os.execvpe(self.START_CTX[0], self.START_CTX['args'], environ)
|
os.execvpe(self.START_CTX[0], self.START_CTX['args'], environ)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user