Browse Source

[pgadmin4] Fix version in conf file

Colin Powell 4 years ago
parent
commit
a6089c70c0

+ 3 - 4
ansible/roles/pgadmin4/tasks/main.yml

@@ -8,10 +8,9 @@
   shell: "pip install https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v5.0/pip/pgadmin4-5.0-py3-none-any.whl"
 
 - name: pgAdmin4 config file installed
-  copy:
-    src: config_local.py
-    dest: /usr/local/lib/python3.7/site-packages/pgadmin4/
-    owner: root
+  template:
+    src: config_local.py.j2
+    dest: /usr/local/lib/python3.7/site-packages/pgadmin4/config_local.py
     mode: 0644
   notify: Supervisor restarted
 

+ 83 - 90
ansible/roles/pgadmin4/files/config_local.py → ansible/roles/pgadmin4/templates/config_local.py.j2

@@ -31,8 +31,8 @@ from pgadmin.utils import env, IS_WIN, fs_short_path
 ##########################################################################
 
 # Name of the application to display in the UI
-APP_NAME = 'pgAdmin 4'
-APP_ICON = 'pg-icon'
+APP_NAME = "pgAdmin 4"
+APP_ICON = "pg-icon"
 
 ##########################################################################
 # Application settings
@@ -47,54 +47,54 @@ APP_ICON = 'pg-icon'
 #
 
 # Application version number components
-APP_RELEASE = 4
-APP_REVISION = 25
+APP_RELEASE = 5
+APP_REVISION = 0
 
 # Application version suffix, e.g. 'beta1', 'dev'. Usually an empty string
 # for GA releases.
-APP_SUFFIX = ''
+APP_SUFFIX = ""
 
 # Numeric application version for upgrade checks. Should be in the format:
 # [X]XYYZZ, where X is the release version, Y is the revision, with a leading
 # zero if needed, and Z represents the suffix, with a leading zero if needed
-APP_VERSION_INT = 42500
+APP_VERSION_INT = 50000
 
 # DO NOT CHANGE!
 # The application version string, constructed from the components
 if not APP_SUFFIX:
-    APP_VERSION = '%s.%s' % (APP_RELEASE, APP_REVISION)
+    APP_VERSION = "%s.%s" % (APP_RELEASE, APP_REVISION)
 else:
-    APP_VERSION = '%s.%s-%s' % (APP_RELEASE, APP_REVISION, APP_SUFFIX)
+    APP_VERSION = "%s.%s-%s" % (APP_RELEASE, APP_REVISION, APP_SUFFIX)
 
 # Copyright string for display in the app
 # Any changes made here must also be made in runtime/pgAdmin4.pro
-APP_COPYRIGHT = 'Copyright (C) 2013 - 2020, The pgAdmin Development Team'
+APP_COPYRIGHT = "Copyright (C) 2013 - 2020, The pgAdmin Development Team"
 
 ##########################################################################
 # Misc stuff
 ##########################################################################
 
 # Path to the online help.
-HELP_PATH = '../../../docs/en_US/_build/html/'
+HELP_PATH = "../../../docs/en_US/_build/html/"
 
 # Languages we support in the UI
 LANGUAGES = {
-    'en': 'English',
-    'zh': 'Chinese (Simplified)',
-    'cs': 'Czech',
-    'fr': 'French',
-    'de': 'German',
-    'it': 'Italian',
-    'ja': 'Japanese',
-    'ko': 'Korean',
-    'pl': 'Polish',
-    'ru': 'Russian',
-    'es': 'Spanish',
+    "en": "English",
+    "zh": "Chinese (Simplified)",
+    "cs": "Czech",
+    "fr": "French",
+    "de": "German",
+    "it": "Italian",
+    "ja": "Japanese",
+    "ko": "Korean",
+    "pl": "Polish",
+    "ru": "Russian",
+    "es": "Spanish",
 }
 
 # DO NOT CHANGE UNLESS YOU KNOW WHAT YOU ARE DOING!
 # List of modules to skip when dynamically loading
-MODULE_BLACKLIST = ['test']
+MODULE_BLACKLIST = ["test"]
 
 # DO NOT CHANGE UNLESS YOU KNOW WHAT YOU ARE DOING!
 # List of treeview browser nodes to skip when dynamically loading
@@ -118,18 +118,18 @@ NODE_BLACKLIST = []
 #       from it, notably various paths such as LOG_FILE and anything
 #       using DATA_DIR.
 
-if (not hasattr(builtins, 'SERVER_MODE')) or builtins.SERVER_MODE is None:
+if (not hasattr(builtins, "SERVER_MODE")) or builtins.SERVER_MODE is None:
     SERVER_MODE = True
 else:
     SERVER_MODE = builtins.SERVER_MODE
 
 # HTTP headers to search for CSRF token when it is not provided in the form.
 # Default is ['X-CSRFToken', 'X-CSRF-Token']
-WTF_CSRF_HEADERS = ['X-pgA-CSRFToken']
+WTF_CSRF_HEADERS = ["X-pgA-CSRFToken"]
 
 # User ID (email address) to use for the default user in desktop mode.
 # The default should be fine here, as it's not exposed in the app.
-DESKTOP_USER = 'pgadmin4@pgadmin.org'
+DESKTOP_USER = "pgadmin4@pgadmin.org"
 
 # This option allows the user to host the application on a LAN
 # Default hosting is on localhost (DEFAULT_SERVER='localhost').
@@ -139,7 +139,7 @@ DESKTOP_USER = 'pgadmin4@pgadmin.org'
 # NOTE: This is NOT recommended for production use, only for debugging
 # or testing. Production installations should be run as a WSGI application
 # behind Apache HTTPD.
-DEFAULT_SERVER = '0.0.0.0'
+DEFAULT_SERVER = "0.0.0.0"
 
 # The default port on which the app server will listen if not set in the
 # environment by the runtime
@@ -152,7 +152,7 @@ DEFAULT_SERVER_PORT = 5050
 X_FRAME_OPTIONS = "SAMEORIGIN"
 
 # Hashing algorithm used for password storage
-SECURITY_PASSWORD_HASH = 'pbkdf2_sha512'
+SECURITY_PASSWORD_HASH = "pbkdf2_sha512"
 
 # Reverse Proxy parameters
 # You must tell the middleware how many proxies set each header
@@ -181,8 +181,11 @@ PROXY_X_PREFIX_COUNT = 0
 
 # COMPRESSION
 COMPRESS_MIMETYPES = [
-    'text/html', 'text/css', 'text/xml', 'application/json',
-    'application/javascript'
+    "text/html",
+    "text/css",
+    "text/xml",
+    "application/json",
+    "application/javascript",
 ]
 COMPRESS_LEVEL = 9
 COMPRESS_MIN_SIZE = 500
@@ -194,10 +197,10 @@ SEND_FILE_MAX_AGE_DEFAULT = 31556952
 # APP_VERSION_INT for cache busting on version upgrade. If the value is set as
 # None or empty string then it will not be added.
 # eg - http:localhost:5050/pgadmin.css?intver=3.13
-APP_VERSION_PARAM = 'ver'
+APP_VERSION_PARAM = "ver"
 
 # Add the internal version param to below extensions only
-APP_VERSION_EXTN = ('.css', '.js', '.html', '.svg', '.png', '.gif', '.ico')
+APP_VERSION_EXTN = (".css", ".js", ".html", ".svg", ".png", ".gif", ".ico")
 
 # Data directory for storage of config settings etc. This shouldn't normally
 # need to be changed - it's here as various other settings depend on it.
@@ -205,14 +208,12 @@ APP_VERSION_EXTN = ('.css', '.js', '.html', '.svg', '.png', '.gif', '.ico')
 # if we're in server mode we use /var/lib/pgadmin, otherwise ~/.pgadmin
 if IS_WIN:
     # Use the short path on windows
-    DATA_DIR = os.path.realpath(
-        os.path.join(fs_short_path(env('APPDATA')), u"pgAdmin")
-    )
+    DATA_DIR = os.path.realpath(os.path.join(fs_short_path(env("APPDATA")), u"pgAdmin"))
 else:
     if SERVER_MODE:
-        DATA_DIR = '/usr/local/lib/pgadmin'
+        DATA_DIR = "/usr/local/lib/pgadmin"
     else:
-        DATA_DIR = os.path.realpath(os.path.expanduser(u'~/.pgadmin/'))
+        DATA_DIR = os.path.realpath(os.path.expanduser(u"~/.pgadmin/"))
 
 # An optional login banner to show security warnings/disclaimers etc. at
 # login and password recovery etc. HTML may be included for basic formatting,
@@ -240,22 +241,22 @@ CONSOLE_LOG_LEVEL = logging.WARNING
 FILE_LOG_LEVEL = logging.WARNING
 
 # Log format.
-CONSOLE_LOG_FORMAT = '%(asctime)s: %(levelname)s\t%(name)s:\t%(message)s'
-FILE_LOG_FORMAT = '%(asctime)s: %(levelname)s\t%(name)s:\t%(message)s'
+CONSOLE_LOG_FORMAT = "%(asctime)s: %(levelname)s\t%(name)s:\t%(message)s"
+FILE_LOG_FORMAT = "%(asctime)s: %(levelname)s\t%(name)s:\t%(message)s"
 
 # Log file name. This goes in the data directory, except on non-Windows
 # platforms in server mode.
 if SERVER_MODE and not IS_WIN:
-    LOG_FILE = '/var/log/pgadmin/pgadmin4.log'
+    LOG_FILE = "/var/log/pgadmin/pgadmin4.log"
 else:
-    LOG_FILE = os.path.join(DATA_DIR, 'pgadmin4.log')
+    LOG_FILE = os.path.join(DATA_DIR, "pgadmin4.log")
 
 ##########################################################################
 # Server Connection Driver Settings
 ##########################################################################
 
 # The default driver used for making connection with PostgreSQL
-PG_DEFAULT_DRIVER = 'psycopg2'
+PG_DEFAULT_DRIVER = "psycopg2"
 
 # Maximum allowed idle time in minutes before which releasing the connection
 # for the particular session. (in minutes)
@@ -268,7 +269,7 @@ MAX_SESSION_IDLE_TIME = 60
 # The default path to the SQLite database used to store user accounts and
 # settings. This default places the file in the same directory as this
 # config file, but generates an absolute path for use througout the app.
-SQLITE_PATH = env('SQLITE_PATH') or os.path.join(DATA_DIR, 'pgadmin4.db')
+SQLITE_PATH = env("SQLITE_PATH") or os.path.join(DATA_DIR, "pgadmin4.db")
 
 # SQLITE_TIMEOUT will define how long to wait before throwing the error -
 # OperationError due to database lock. On slower system, you may need to change
@@ -303,9 +304,9 @@ MAX_QUERY_HIST_STORED = 20
 # SESSION_DB_PATH = '/run/shm/pgAdmin4_session'
 #
 ##########################################################################
-SESSION_DB_PATH = os.path.join(DATA_DIR, 'sessions')
+SESSION_DB_PATH = os.path.join(DATA_DIR, "sessions")
 
-SESSION_COOKIE_NAME = 'pga4_session'
+SESSION_COOKIE_NAME = "pga4_session"
 
 ##########################################################################
 # Mail server settings
@@ -314,29 +315,28 @@ SESSION_COOKIE_NAME = 'pga4_session'
 # These settings are used when running in web server mode for confirming
 # and resetting passwords etc.
 # See: http://pythonhosted.org/Flask-Mail/ for more info
-MAIL_SERVER = 'localhost'
-MAIL_PORT = 25
-MAIL_USE_SSL = False
+MAIL_SERVER = "box.unbl.ink"
+MAIL_PORT = 587
+MAIL_USE_SSL = True
 MAIL_USE_TLS = False
-MAIL_USERNAME = ''
-MAIL_PASSWORD = ''
+MAIL_USERNAME = "services@unbl.ink"
+MAIL_PASSWORD = "{{services_unblink_email_pass}}"
 MAIL_DEBUG = False
 
 # Flask-Security overrides Flask-Mail's MAIL_DEFAULT_SENDER setting, so
 # that should be set as such:
-SECURITY_EMAIL_SENDER = 'no-reply@localhost'
+SECURITY_EMAIL_SENDER = "no-reply@localhost"
 
 ##########################################################################
 # Mail content settings
 ##########################################################################
 
 # These settings define the content of password reset emails
-SECURITY_EMAIL_SUBJECT_PASSWORD_RESET = "Password reset instructions for %s" \
-                                        % APP_NAME
-SECURITY_EMAIL_SUBJECT_PASSWORD_NOTICE = "Your %s password has been reset" \
-                                         % APP_NAME
-SECURITY_EMAIL_SUBJECT_PASSWORD_CHANGE_NOTICE = \
+SECURITY_EMAIL_SUBJECT_PASSWORD_RESET = "Password reset instructions for %s" % APP_NAME
+SECURITY_EMAIL_SUBJECT_PASSWORD_NOTICE = "Your %s password has been reset" % APP_NAME
+SECURITY_EMAIL_SUBJECT_PASSWORD_CHANGE_NOTICE = (
     "Your password for %s has been changed" % APP_NAME
+)
 
 ##########################################################################
 # Upgrade checks
@@ -346,18 +346,17 @@ SECURITY_EMAIL_SUBJECT_PASSWORD_CHANGE_NOTICE = \
 UPGRADE_CHECK_ENABLED = True
 
 # Where should we get the data from?
-UPGRADE_CHECK_URL = 'https://www.pgadmin.org/versions.json'
+UPGRADE_CHECK_URL = "https://www.pgadmin.org/versions.json"
 
 # What key should we look at in the upgrade data file?
-UPGRADE_CHECK_KEY = 'pgadmin4'
+UPGRADE_CHECK_KEY = "pgadmin4"
 
 # Which CA file should we use?
 # Default to cacert.pem in the same directory as config.py et al.
-CA_FILE = os.path.join(os.path.dirname(os.path.realpath(__file__)),
-                       "cacert.pem")
+CA_FILE = os.path.join(os.path.dirname(os.path.realpath(__file__)), "cacert.pem")
 
 # Check if the detected browser is supported
-CHECK_SUPPORTED_BROWSER = True
+CHECK_SUPPORTED_BROWSER = False
 
 ##########################################################################
 # Storage Manager storage url config settings
@@ -370,7 +369,7 @@ CHECK_SUPPORTED_BROWSER = True
 # 2. Set path manually like
 # STORAGE_DIR = "/path/to/directory/"
 ##########################################################################
-STORAGE_DIR = os.path.join(DATA_DIR, 'storage')
+STORAGE_DIR = os.path.join(DATA_DIR, "storage")
 
 ##########################################################################
 # Default locations for binary utilities (pg_dump, pg_restore etc)
@@ -387,18 +386,14 @@ STORAGE_DIR = os.path.join(DATA_DIR, 'storage')
 # $DIR/../../SharedSupport
 #
 ##########################################################################
-DEFAULT_BINARY_PATHS = {
-    "pg": "",
-    "ppas": "",
-    "gpdb": ""
-}
+DEFAULT_BINARY_PATHS = {"pg": "", "ppas": "", "gpdb": ""}
 
 ##########################################################################
 # Test settings - used primarily by the regression suite, not for users
 ##########################################################################
 
 # The default path for SQLite database for testing
-TEST_SQLITE_PATH = os.path.join(DATA_DIR, 'test_pgadmin4.db')
+TEST_SQLITE_PATH = os.path.join(DATA_DIR, "test_pgadmin4.db")
 
 ##########################################################################
 # Allows flask application to response to the each request asynchronously
@@ -425,17 +420,15 @@ SHOW_GRAVATAR_IMAGE = True
 ##########################################################################
 # Set cookie path
 ##########################################################################
-COOKIE_DEFAULT_PATH = '/'
+COOKIE_DEFAULT_PATH = "/"
 COOKIE_DEFAULT_DOMAIN = None
 SESSION_COOKIE_DOMAIN = None
-SESSION_COOKIE_SAMESITE = 'Lax'
+SESSION_COOKIE_SAMESITE = "Lax"
 
 #########################################################################
 # Skip storing session in files and cache for specific paths
 #########################################################################
-SESSION_SKIP_PATHS = [
-    '/misc/ping'
-]
+SESSION_SKIP_PATHS = ["/misc/ping"]
 
 ##########################################################################
 # Session expiration support
@@ -498,7 +491,7 @@ ENHANCED_COOKIE_PROTECTION = True
 # ['ldap', 'internal']. pgAdmin will authenticate the user with ldap first,
 # in case of failure internal authentication will be done.
 
-AUTHENTICATION_SOURCES = ['internal']
+AUTHENTICATION_SOURCES = ["internal"]
 
 ##########################################################################
 # LDAP Configuration
@@ -515,11 +508,11 @@ LDAP_CONNECTION_TIMEOUT = 10
 
 # Server connection details (REQUIRED)
 # example: ldap://<ip-address>:<port> or ldap://<hostname>:<port>
-LDAP_SERVER_URI = 'ldap://<ip-address>:<port>'
+LDAP_SERVER_URI = "ldap://<ip-address>:<port>"
 
 # The LDAP attribute containing user names. In OpenLDAP, this may be 'uid'
 # whilst in AD, 'sAMAccountName' might be appropriate. (REQUIRED)
-LDAP_USERNAME_ATTRIBUTE = '<User-id>'
+LDAP_USERNAME_ATTRIBUTE = "<User-id>"
 
 ##########################################################################
 # 3 ways to configure LDAP as follows (Choose anyone):
@@ -552,29 +545,29 @@ LDAP_ANONYMOUS_BIND = False
 # AD example:
 # (&(objectClass=user)(memberof=CN=MYGROUP,CN=Users,dc=example,dc=com))
 # OpenLDAP example: CN=Users,dc=example,dc=com
-LDAP_BASE_DN = '<Base-DN>'
+LDAP_BASE_DN = "<Base-DN>"
 
 ##########################################################################
 
 # Search ldap for further authentication (REQUIRED)
 # It can be optional while bind as pgAdmin user
-LDAP_SEARCH_BASE_DN = '<Search-Base-DN>'
+LDAP_SEARCH_BASE_DN = "<Search-Base-DN>"
 
 # Filter string for the user search.
 # For OpenLDAP, '(cn=*)' may well be enough.
 # For AD, you might use '(objectClass=user)' (REQUIRED)
-LDAP_SEARCH_FILTER = '(objectclass=*)'
+LDAP_SEARCH_FILTER = "(objectclass=*)"
 
 # Search scope for users (one of BASE, LEVEL or SUBTREE)
-LDAP_SEARCH_SCOPE = 'SUBTREE'
+LDAP_SEARCH_SCOPE = "SUBTREE"
 
 # Use TLS? If the URI scheme is ldaps://, this is ignored.
 LDAP_USE_STARTTLS = False
 
 # TLS/SSL certificates. Specify if required, otherwise leave empty
-LDAP_CA_CERT_FILE = ''
-LDAP_CERT_FILE = ''
-LDAP_KEY_FILE = ''
+LDAP_CA_CERT_FILE = ""
+LDAP_CERT_FILE = ""
+LDAP_KEY_FILE = ""
 
 ##########################################################################
 # Local config settings
@@ -595,13 +588,13 @@ except ImportError:
 # Load system config overrides. We do this last, so that the sysadmin can
 # override anything they want from a config file that's in a protected system
 # directory and away from pgAdmin to avoid invalidating signatures.
-system_config_dir = '/etc/pgadmin'
-if sys.platform.startswith('win32'):
-    system_config_dir = os.environ['CommonProgramFiles'] + '/pgadmin'
-elif sys.platform.startswith('darwin'):
-    system_config_dir = '/Library/Preferences/pgadmin'
+system_config_dir = "/etc/pgadmin"
+if sys.platform.startswith("win32"):
+    system_config_dir = os.environ["CommonProgramFiles"] + "/pgadmin"
+elif sys.platform.startswith("darwin"):
+    system_config_dir = "/Library/Preferences/pgadmin"
 
-if os.path.exists(system_config_dir + '/config_system.py'):
+if os.path.exists(system_config_dir + "/config_system.py"):
     try:
         sys.path.insert(0, system_config_dir)
         from config_system import *
@@ -609,8 +602,8 @@ if os.path.exists(system_config_dir + '/config_system.py'):
         pass
 
 # Override DEFAULT_SERVER value from environment variable.
-if 'PGADMIN_CONFIG_DEFAULT_SERVER' in os.environ:
-    DEFAULT_SERVER = os.environ['PGADMIN_CONFIG_DEFAULT_SERVER']
+if "PGADMIN_CONFIG_DEFAULT_SERVER" in os.environ:
+    DEFAULT_SERVER = os.environ["PGADMIN_CONFIG_DEFAULT_SERVER"]
 
 # Disable USER_INACTIVITY_TIMEOUT when SERVER_MODE=False
 if not SERVER_MODE: