mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Rename some internal environment variables that could conflict with Kubernetes. Fixes #4999.
This commit is contained in:
parent
8e8f89aa8f
commit
8cb239abcb
@ -19,4 +19,5 @@ Bug fixes
|
||||
|
||||
| `Issue #4506 <https://redmine.postgresql.org/issues/4506>`_ - Fix an issue where clicking on an empty textbox like fill factor or comments, considers it as change and enabled the save button.
|
||||
| `Issue #4943 <https://redmine.postgresql.org/issues/4943>`_ - Added more information to the 'Database connected/disconnected' message.
|
||||
| `Issue #4999 <https://redmine.postgresql.org/issues/4999>`_ - Rename some internal environment variables that could conflict with Kubernetes.
|
||||
| `Issue #5004 <https://redmine.postgresql.org/issues/5004>`_ - Fix vulnerability issues reported by 'yarn audit'. Replace the deprecated uglifyjs-webpack-plugin with a terser-webpack-plugin.
|
@ -341,8 +341,8 @@ void Server::run()
|
||||
|
||||
// Set the port number and key, and force SERVER_MODE off.
|
||||
Logger::GetLogger()->Log("Set the port number, key and force SERVER_MODE off");
|
||||
PyRun_SimpleString(QString("PGADMIN_PORT = %1").arg(m_port).toLatin1());
|
||||
PyRun_SimpleString(QString("PGADMIN_KEY = '%1'").arg(m_key).toLatin1());
|
||||
PyRun_SimpleString(QString("PGADMIN_INT_PORT = %1").arg(m_port).toLatin1());
|
||||
PyRun_SimpleString(QString("PGADMIN_INT_KEY = '%1'").arg(m_key).toLatin1());
|
||||
PyRun_SimpleString(QString("SERVER_MODE = False").toLatin1());
|
||||
|
||||
// Run the app!
|
||||
|
@ -129,15 +129,15 @@ if config.DEBUG:
|
||||
# runtime if we're running in desktop mode, otherwise we'll just use the
|
||||
# Flask default.
|
||||
PGADMIN_RUNTIME = False
|
||||
if 'PGADMIN_PORT' in globals():
|
||||
if 'PGADMIN_INT_PORT' in globals():
|
||||
app.logger.debug(
|
||||
'Running under the desktop runtime, port: %s',
|
||||
globals()['PGADMIN_PORT']
|
||||
globals()['PGADMIN_INT_PORT']
|
||||
)
|
||||
server_port = int(globals()['PGADMIN_PORT'])
|
||||
server_port = int(globals()['PGADMIN_INT_PORT'])
|
||||
PGADMIN_RUNTIME = True
|
||||
elif 'PGADMIN_PORT' in os.environ:
|
||||
port = os.environ['PGADMIN_PORT']
|
||||
elif 'PGADMIN_INT_PORT' in os.environ:
|
||||
port = os.environ['PGADMIN_INT_PORT']
|
||||
app.logger.debug(
|
||||
'Not running under the desktop runtime, port: %s',
|
||||
port
|
||||
@ -154,11 +154,11 @@ else:
|
||||
app.PGADMIN_RUNTIME = PGADMIN_RUNTIME
|
||||
|
||||
# Set the key if appropriate
|
||||
if 'PGADMIN_KEY' in globals():
|
||||
app.PGADMIN_KEY = globals()['PGADMIN_KEY']
|
||||
app.logger.debug("Desktop security key: %s" % app.PGADMIN_KEY)
|
||||
if 'PGADMIN_INT_KEY' in globals():
|
||||
app.PGADMIN_INT_KEY = globals()['PGADMIN_INT_KEY']
|
||||
app.logger.debug("Desktop security key: %s" % app.PGADMIN_INT_KEY)
|
||||
else:
|
||||
app.PGADMIN_KEY = ''
|
||||
app.PGADMIN_INT_KEY = ''
|
||||
|
||||
# Output a startup message if we're not under the runtime and startup.
|
||||
# If we're under WSGI, we don't need to worry about this
|
||||
|
@ -620,13 +620,11 @@ def create_app(app_name=None):
|
||||
|
||||
# Check the auth key is valid, if it's set, and we're not in server
|
||||
# mode, and it's not a help file request.
|
||||
if not config.SERVER_MODE and app.PGADMIN_KEY != '':
|
||||
if (
|
||||
('key' not in request.args or
|
||||
request.args['key'] != app.PGADMIN_KEY) and
|
||||
request.cookies.get('PGADMIN_KEY') != app.PGADMIN_KEY and
|
||||
request.endpoint != 'help.static'
|
||||
):
|
||||
if not config.SERVER_MODE and app.PGADMIN_INT_KEY != '':
|
||||
if (('key' not in request.args or
|
||||
request.args['key'] != app.PGADMIN_INT_KEY) and
|
||||
request.cookies.get('PGADMIN_INT_KEY') !=
|
||||
app.PGADMIN_INT_KEY and request.endpoint != 'help.static'):
|
||||
abort(401)
|
||||
|
||||
if not config.SERVER_MODE and not current_user.is_authenticated:
|
||||
@ -659,7 +657,7 @@ def create_app(app_name=None):
|
||||
if config.COOKIE_DEFAULT_DOMAIN and \
|
||||
config.COOKIE_DEFAULT_DOMAIN != 'localhost':
|
||||
domain['domain'] = config.COOKIE_DEFAULT_DOMAIN
|
||||
response.set_cookie('PGADMIN_KEY', value=request.args['key'],
|
||||
response.set_cookie('PGADMIN_INT_KEY', value=request.args['key'],
|
||||
path=config.COOKIE_DEFAULT_PATH,
|
||||
**domain)
|
||||
|
||||
|
@ -28,7 +28,7 @@ class AppStarter:
|
||||
""" This function start the subprocess to start pgAdmin app """
|
||||
random_server_port = str(random.randint(10000, 65535))
|
||||
env = {
|
||||
"PGADMIN_PORT": random_server_port,
|
||||
"PGADMIN_INT_PORT": random_server_port,
|
||||
"SQLITE_PATH": str(self.app_config.TEST_SQLITE_PATH)
|
||||
}
|
||||
env.update(os.environ)
|
||||
|
@ -106,7 +106,7 @@ config.CONSOLE_LOG_LEVEL = WARNING
|
||||
# Create the app
|
||||
app = create_app()
|
||||
|
||||
app.PGADMIN_KEY = ''
|
||||
app.PGADMIN_INT_KEY = ''
|
||||
app.config.update({'SESSION_COOKIE_DOMAIN': None})
|
||||
driver = None
|
||||
app_starter = None
|
||||
|
Loading…
Reference in New Issue
Block a user