config_local.py 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. ##########################################################################
  4. #
  5. # pgAdmin 4 - PostgreSQL Tools
  6. #
  7. # Copyright (C) 2013 - 2020, The pgAdmin Development Team
  8. # This software is released under the PostgreSQL Licence
  9. #
  10. # config.py - Core application configuration settings
  11. #
  12. ##########################################################################
  13. import builtins
  14. import logging
  15. import os
  16. import sys
  17. # We need to include the root directory in sys.path to ensure that we can
  18. # find everything we need when running in the standalone runtime.
  19. root = os.path.dirname(os.path.realpath(__file__))
  20. if sys.path[0] != root:
  21. sys.path.insert(0, root)
  22. from pgadmin.utils import env, IS_WIN, fs_short_path
  23. ##########################################################################
  24. # Application settings
  25. ##########################################################################
  26. # Name of the application to display in the UI
  27. APP_NAME = 'pgAdmin 4'
  28. APP_ICON = 'pg-icon'
  29. ##########################################################################
  30. # Application settings
  31. ##########################################################################
  32. # NOTE!!!
  33. # If you change any of APP_RELEASE, APP_REVISION or APP_SUFFIX, then you
  34. # must also change APP_VERSION_INT to match.
  35. #
  36. # Any changes made here must also be made in runtime/pgAdmin4.pro and
  37. # runtime/Info.plist
  38. #
  39. # Application version number components
  40. APP_RELEASE = 4
  41. APP_REVISION = 25
  42. # Application version suffix, e.g. 'beta1', 'dev'. Usually an empty string
  43. # for GA releases.
  44. APP_SUFFIX = ''
  45. # Numeric application version for upgrade checks. Should be in the format:
  46. # [X]XYYZZ, where X is the release version, Y is the revision, with a leading
  47. # zero if needed, and Z represents the suffix, with a leading zero if needed
  48. APP_VERSION_INT = 42500
  49. # DO NOT CHANGE!
  50. # The application version string, constructed from the components
  51. if not APP_SUFFIX:
  52. APP_VERSION = '%s.%s' % (APP_RELEASE, APP_REVISION)
  53. else:
  54. APP_VERSION = '%s.%s-%s' % (APP_RELEASE, APP_REVISION, APP_SUFFIX)
  55. # Copyright string for display in the app
  56. # Any changes made here must also be made in runtime/pgAdmin4.pro
  57. APP_COPYRIGHT = 'Copyright (C) 2013 - 2020, The pgAdmin Development Team'
  58. ##########################################################################
  59. # Misc stuff
  60. ##########################################################################
  61. # Path to the online help.
  62. HELP_PATH = '../../../docs/en_US/_build/html/'
  63. # Languages we support in the UI
  64. LANGUAGES = {
  65. 'en': 'English',
  66. 'zh': 'Chinese (Simplified)',
  67. 'cs': 'Czech',
  68. 'fr': 'French',
  69. 'de': 'German',
  70. 'it': 'Italian',
  71. 'ja': 'Japanese',
  72. 'ko': 'Korean',
  73. 'pl': 'Polish',
  74. 'ru': 'Russian',
  75. 'es': 'Spanish',
  76. }
  77. # DO NOT CHANGE UNLESS YOU KNOW WHAT YOU ARE DOING!
  78. # List of modules to skip when dynamically loading
  79. MODULE_BLACKLIST = ['test']
  80. # DO NOT CHANGE UNLESS YOU KNOW WHAT YOU ARE DOING!
  81. # List of treeview browser nodes to skip when dynamically loading
  82. NODE_BLACKLIST = []
  83. ##########################################################################
  84. # Server settings
  85. ##########################################################################
  86. # The server mode determines whether or not we're running on a web server
  87. # requiring user authentication, or desktop mode which uses an automatic
  88. # default login.
  89. #
  90. # DO NOT DISABLE SERVER MODE IF RUNNING ON A WEBSERVER!!
  91. #
  92. # We only set SERVER_MODE if it's not already set. That's to allow the
  93. # runtime to force it to False.
  94. #
  95. # NOTE: If you change the value of SERVER_MODE in an included config file,
  96. # you may also need to redefine any values below that are derived
  97. # from it, notably various paths such as LOG_FILE and anything
  98. # using DATA_DIR.
  99. if (not hasattr(builtins, 'SERVER_MODE')) or builtins.SERVER_MODE is None:
  100. SERVER_MODE = True
  101. else:
  102. SERVER_MODE = builtins.SERVER_MODE
  103. # HTTP headers to search for CSRF token when it is not provided in the form.
  104. # Default is ['X-CSRFToken', 'X-CSRF-Token']
  105. WTF_CSRF_HEADERS = ['X-pgA-CSRFToken']
  106. # User ID (email address) to use for the default user in desktop mode.
  107. # The default should be fine here, as it's not exposed in the app.
  108. DESKTOP_USER = 'pgadmin4@pgadmin.org'
  109. # This option allows the user to host the application on a LAN
  110. # Default hosting is on localhost (DEFAULT_SERVER='localhost').
  111. # To host pgAdmin4 over LAN set DEFAULT_SERVER='0.0.0.0' (or a specific
  112. # adaptor address.
  113. #
  114. # NOTE: This is NOT recommended for production use, only for debugging
  115. # or testing. Production installations should be run as a WSGI application
  116. # behind Apache HTTPD.
  117. DEFAULT_SERVER = '0.0.0.0'
  118. # The default port on which the app server will listen if not set in the
  119. # environment by the runtime
  120. DEFAULT_SERVER_PORT = 5050
  121. # Enable X-Frame-Option protection.
  122. # Set to one of "SAMEORIGIN", "ALLOW-FROM origin" or "" to disable.
  123. # Note that "DENY" is NOT supported (and will be silently ignored).
  124. # See https://tools.ietf.org/html/rfc7034 for more info.
  125. X_FRAME_OPTIONS = "SAMEORIGIN"
  126. # Hashing algorithm used for password storage
  127. SECURITY_PASSWORD_HASH = 'pbkdf2_sha512'
  128. # Reverse Proxy parameters
  129. # You must tell the middleware how many proxies set each header
  130. # so it knows what values to trust.
  131. # See https://tinyurl.com/yyg7r9av
  132. # for more information.
  133. # Number of values to trust for X-Forwarded-For
  134. PROXY_X_FOR_COUNT = 1
  135. # Number of values to trust for X-Forwarded-Proto.
  136. PROXY_X_PROTO_COUNT = 1
  137. # Number of values to trust for X-Forwarded-Host.
  138. PROXY_X_HOST_COUNT = 0
  139. # Number of values to trust for X-Forwarded-Port.
  140. PROXY_X_PORT_COUNT = 1
  141. # Number of values to trust for X-Forwarded-Prefix.
  142. PROXY_X_PREFIX_COUNT = 0
  143. # NOTE: CSRF_SESSION_KEY, SECRET_KEY and SECURITY_PASSWORD_SALT are no
  144. # longer part of the main configuration, but are stored in the
  145. # configuration databases 'keys' table and are auto-generated.
  146. # COMPRESSION
  147. COMPRESS_MIMETYPES = [
  148. 'text/html', 'text/css', 'text/xml', 'application/json',
  149. 'application/javascript'
  150. ]
  151. COMPRESS_LEVEL = 9
  152. COMPRESS_MIN_SIZE = 500
  153. # Set the cache control max age for static files in flask to 1 year
  154. SEND_FILE_MAX_AGE_DEFAULT = 31556952
  155. # This will be added to static urls as url parameter with value as
  156. # APP_VERSION_INT for cache busting on version upgrade. If the value is set as
  157. # None or empty string then it will not be added.
  158. # eg - http:localhost:5050/pgadmin.css?intver=3.13
  159. APP_VERSION_PARAM = 'ver'
  160. # Add the internal version param to below extensions only
  161. APP_VERSION_EXTN = ('.css', '.js', '.html', '.svg', '.png', '.gif', '.ico')
  162. # Data directory for storage of config settings etc. This shouldn't normally
  163. # need to be changed - it's here as various other settings depend on it.
  164. # On Windows, we always store data in %APPDATA%\pgAdmin. On other platforms,
  165. # if we're in server mode we use /var/lib/pgadmin, otherwise ~/.pgadmin
  166. if IS_WIN:
  167. # Use the short path on windows
  168. DATA_DIR = os.path.realpath(
  169. os.path.join(fs_short_path(env('APPDATA')), u"pgAdmin")
  170. )
  171. else:
  172. if SERVER_MODE:
  173. DATA_DIR = '/usr/local/lib/pgadmin'
  174. else:
  175. DATA_DIR = os.path.realpath(os.path.expanduser(u'~/.pgadmin/'))
  176. # An optional login banner to show security warnings/disclaimers etc. at
  177. # login and password recovery etc. HTML may be included for basic formatting,
  178. # For example:
  179. # LOGIN_BANNER = "<h4>Authorised Users Only!</h4>" \
  180. # "Unauthorised use is strictly forbidden."
  181. LOGIN_BANNER = ""
  182. ##########################################################################
  183. # Log settings
  184. ##########################################################################
  185. # Debug mode?
  186. DEBUG = False
  187. # Application log level - one of:
  188. # CRITICAL 50
  189. # ERROR 40
  190. # WARNING 30
  191. # SQL 25
  192. # INFO 20
  193. # DEBUG 10
  194. # NOTSET 0
  195. CONSOLE_LOG_LEVEL = logging.WARNING
  196. FILE_LOG_LEVEL = logging.WARNING
  197. # Log format.
  198. CONSOLE_LOG_FORMAT = '%(asctime)s: %(levelname)s\t%(name)s:\t%(message)s'
  199. FILE_LOG_FORMAT = '%(asctime)s: %(levelname)s\t%(name)s:\t%(message)s'
  200. # Log file name. This goes in the data directory, except on non-Windows
  201. # platforms in server mode.
  202. if SERVER_MODE and not IS_WIN:
  203. LOG_FILE = '/var/log/pgadmin/pgadmin4.log'
  204. else:
  205. LOG_FILE = os.path.join(DATA_DIR, 'pgadmin4.log')
  206. ##########################################################################
  207. # Server Connection Driver Settings
  208. ##########################################################################
  209. # The default driver used for making connection with PostgreSQL
  210. PG_DEFAULT_DRIVER = 'psycopg2'
  211. # Maximum allowed idle time in minutes before which releasing the connection
  212. # for the particular session. (in minutes)
  213. MAX_SESSION_IDLE_TIME = 60
  214. ##########################################################################
  215. # User account and settings storage
  216. ##########################################################################
  217. # The default path to the SQLite database used to store user accounts and
  218. # settings. This default places the file in the same directory as this
  219. # config file, but generates an absolute path for use througout the app.
  220. SQLITE_PATH = env('SQLITE_PATH') or os.path.join(DATA_DIR, 'pgadmin4.db')
  221. # SQLITE_TIMEOUT will define how long to wait before throwing the error -
  222. # OperationError due to database lock. On slower system, you may need to change
  223. # this to some higher value.
  224. # (Default: 500 milliseconds)
  225. SQLITE_TIMEOUT = 500
  226. # Allow database connection passwords to be saved if the user chooses.
  227. # Set to False to disable password saving.
  228. ALLOW_SAVE_PASSWORD = True
  229. # Maximum number of history queries stored per user/server/database
  230. MAX_QUERY_HIST_STORED = 20
  231. ##########################################################################
  232. # Server-side session storage path
  233. #
  234. # SESSION_DB_PATH (Default: $HOME/.pgadmin4/sessions)
  235. ##########################################################################
  236. #
  237. # We use SQLite for server-side session storage. There will be one
  238. # SQLite database object per session created.
  239. #
  240. # Specify the path used to store your session objects.
  241. #
  242. # If the specified directory does not exist, the setup script will create
  243. # it with permission mode 700 to keep the session database secure.
  244. #
  245. # On certain systems, you can use shared memory (tmpfs) for maximum
  246. # scalability, for example, on Ubuntu:
  247. #
  248. # SESSION_DB_PATH = '/run/shm/pgAdmin4_session'
  249. #
  250. ##########################################################################
  251. SESSION_DB_PATH = os.path.join(DATA_DIR, 'sessions')
  252. SESSION_COOKIE_NAME = 'pga4_session'
  253. ##########################################################################
  254. # Mail server settings
  255. ##########################################################################
  256. # These settings are used when running in web server mode for confirming
  257. # and resetting passwords etc.
  258. # See: http://pythonhosted.org/Flask-Mail/ for more info
  259. MAIL_SERVER = 'localhost'
  260. MAIL_PORT = 25
  261. MAIL_USE_SSL = False
  262. MAIL_USE_TLS = False
  263. MAIL_USERNAME = ''
  264. MAIL_PASSWORD = ''
  265. MAIL_DEBUG = False
  266. # Flask-Security overrides Flask-Mail's MAIL_DEFAULT_SENDER setting, so
  267. # that should be set as such:
  268. SECURITY_EMAIL_SENDER = 'no-reply@localhost'
  269. ##########################################################################
  270. # Mail content settings
  271. ##########################################################################
  272. # These settings define the content of password reset emails
  273. SECURITY_EMAIL_SUBJECT_PASSWORD_RESET = "Password reset instructions for %s" \
  274. % APP_NAME
  275. SECURITY_EMAIL_SUBJECT_PASSWORD_NOTICE = "Your %s password has been reset" \
  276. % APP_NAME
  277. SECURITY_EMAIL_SUBJECT_PASSWORD_CHANGE_NOTICE = \
  278. "Your password for %s has been changed" % APP_NAME
  279. ##########################################################################
  280. # Upgrade checks
  281. ##########################################################################
  282. # Check for new versions of the application?
  283. UPGRADE_CHECK_ENABLED = True
  284. # Where should we get the data from?
  285. UPGRADE_CHECK_URL = 'https://www.pgadmin.org/versions.json'
  286. # What key should we look at in the upgrade data file?
  287. UPGRADE_CHECK_KEY = 'pgadmin4'
  288. # Which CA file should we use?
  289. # Default to cacert.pem in the same directory as config.py et al.
  290. CA_FILE = os.path.join(os.path.dirname(os.path.realpath(__file__)),
  291. "cacert.pem")
  292. # Check if the detected browser is supported
  293. CHECK_SUPPORTED_BROWSER = True
  294. ##########################################################################
  295. # Storage Manager storage url config settings
  296. # If user sets STORAGE_DIR to empty it will show all volumes if platform
  297. # is Windows, '/' if it is Linux, Mac or any other unix type system.
  298. # For example:
  299. # 1. STORAGE_DIR = get_drive("C") or get_drive() # return C:/ by default
  300. # where C can be any drive character such as "D", "E", "G" etc
  301. # 2. Set path manually like
  302. # STORAGE_DIR = "/path/to/directory/"
  303. ##########################################################################
  304. STORAGE_DIR = os.path.join(DATA_DIR, 'storage')
  305. ##########################################################################
  306. # Default locations for binary utilities (pg_dump, pg_restore etc)
  307. #
  308. # These are intentionally left empty in the main config file, but are
  309. # expected to be overridden by packagers in config_distro.py.
  310. #
  311. # A default location can be specified for each database driver ID, in
  312. # a dictionary. Either an absolute or relative path can be specified.
  313. # In cases where it may be difficult to know what the working directory
  314. # is, "$DIR" can be specified. This will be replaced with the path to the
  315. # top-level pgAdmin4.py file. For example, on macOS we might use:
  316. #
  317. # $DIR/../../SharedSupport
  318. #
  319. ##########################################################################
  320. DEFAULT_BINARY_PATHS = {
  321. "pg": "",
  322. "ppas": "",
  323. "gpdb": ""
  324. }
  325. ##########################################################################
  326. # Test settings - used primarily by the regression suite, not for users
  327. ##########################################################################
  328. # The default path for SQLite database for testing
  329. TEST_SQLITE_PATH = os.path.join(DATA_DIR, 'test_pgadmin4.db')
  330. ##########################################################################
  331. # Allows flask application to response to the each request asynchronously
  332. ##########################################################################
  333. THREADED_MODE = True
  334. ##########################################################################
  335. # Do not allow SQLALCHEMY to track modification as it is going to be
  336. # deprecated in future
  337. ##########################################################################
  338. SQLALCHEMY_TRACK_MODIFICATIONS = False
  339. ##########################################################################
  340. # Number of records to fetch in one batch in query tool when query result
  341. # set is large.
  342. ##########################################################################
  343. ON_DEMAND_RECORD_COUNT = 1000
  344. ##########################################################################
  345. # Allow users to display Gravatar image for their username in Server mode
  346. ##########################################################################
  347. SHOW_GRAVATAR_IMAGE = True
  348. ##########################################################################
  349. # Set cookie path
  350. ##########################################################################
  351. COOKIE_DEFAULT_PATH = '/'
  352. COOKIE_DEFAULT_DOMAIN = None
  353. SESSION_COOKIE_DOMAIN = None
  354. SESSION_COOKIE_SAMESITE = 'Lax'
  355. #########################################################################
  356. # Skip storing session in files and cache for specific paths
  357. #########################################################################
  358. SESSION_SKIP_PATHS = [
  359. '/misc/ping'
  360. ]
  361. ##########################################################################
  362. # Session expiration support
  363. ##########################################################################
  364. # SESSION_EXPIRATION_TIME is the interval in Days. Session will be
  365. # expire after the specified number of *days*.
  366. SESSION_EXPIRATION_TIME = 1
  367. # CHECK_SESSION_FILES_INTERVAL is interval in Hours. Application will check
  368. # the session files for cleanup after specified number of *hours*.
  369. CHECK_SESSION_FILES_INTERVAL = 24
  370. # USER_INACTIVITY_TIMEOUT is interval in Seconds. If the pgAdmin screen is left
  371. # unattended for <USER_INACTIVITY_TIMEOUT> seconds then the user will
  372. # be logged out. When set to 0, the timeout will be disabled.
  373. # If pgAdmin doesn't detect any activity in the time specified (in seconds),
  374. # the user will be forcibly logged out from pgAdmin. Set to zero to disable
  375. # the timeout.
  376. # Note: This is applicable only for SERVER_MODE=True.
  377. USER_INACTIVITY_TIMEOUT = 0
  378. # OVERRIDE_USER_INACTIVITY_TIMEOUT when set to True will override
  379. # USER_INACTIVITY_TIMEOUT when long running queries in the Query Tool
  380. # or Debugger are running. When the queries complete, the inactivity timer
  381. # will restart in this case. If set to False, user inactivity may cause
  382. # transactions or in-process debugging sessions to be aborted.
  383. OVERRIDE_USER_INACTIVITY_TIMEOUT = True
  384. ##########################################################################
  385. # SSH Tunneling supports only for Python 2.7 and 3.4+
  386. ##########################################################################
  387. SUPPORT_SSH_TUNNEL = True
  388. # Allow SSH Tunnel passwords to be saved if the user chooses.
  389. # Set to False to disable password saving.
  390. ALLOW_SAVE_TUNNEL_PASSWORD = False
  391. ##########################################################################
  392. # Master password is used to encrypt/decrypt saved server passwords
  393. # Applicable for desktop mode only
  394. ##########################################################################
  395. MASTER_PASSWORD_REQUIRED = True
  396. ##########################################################################
  397. # Allows pgAdmin4 to create session cookies based on IP address, so even
  398. # if a cookie is stolen, the attacker will not be able to connect to the
  399. # server using that stolen cookie.
  400. # Note: This can cause problems when the server is deployed in dynamic IP
  401. # address hosting environments, such as Kubernetes or behind load
  402. # balancers. In such cases, this option should be set to False.
  403. ##########################################################################
  404. ENHANCED_COOKIE_PROTECTION = True
  405. ##########################################################################
  406. # External Authentication Sources
  407. ##########################################################################
  408. # Default setting is internal
  409. # External Supported Sources: ldap
  410. # Multiple authentication can be achieved by setting this parameter to
  411. # ['ldap', 'internal']. pgAdmin will authenticate the user with ldap first,
  412. # in case of failure internal authentication will be done.
  413. AUTHENTICATION_SOURCES = ['internal']
  414. ##########################################################################
  415. # LDAP Configuration
  416. ##########################################################################
  417. # After ldap authentication, user will be added into the SQLite database
  418. # automatically, if set to True.
  419. # Set it to False, if user should not be added automatically,
  420. # in this case Admin has to add the user manually in the SQLite database.
  421. LDAP_AUTO_CREATE_USER = True
  422. # Connection timeout
  423. LDAP_CONNECTION_TIMEOUT = 10
  424. # Server connection details (REQUIRED)
  425. # example: ldap://<ip-address>:<port> or ldap://<hostname>:<port>
  426. LDAP_SERVER_URI = 'ldap://<ip-address>:<port>'
  427. # The LDAP attribute containing user names. In OpenLDAP, this may be 'uid'
  428. # whilst in AD, 'sAMAccountName' might be appropriate. (REQUIRED)
  429. LDAP_USERNAME_ATTRIBUTE = '<User-id>'
  430. ##########################################################################
  431. # 3 ways to configure LDAP as follows (Choose anyone):
  432. # 1. Dedicated User binding
  433. # LDAP Bind User DN Example: cn=username,dc=example,dc=com
  434. # Set this parameter to allow the connection to bind using a dedicated user.
  435. # After the connection is made, the pgadmin login user will be further
  436. # authenticated by the username and password provided
  437. # at the login screen.
  438. LDAP_BIND_USER = None
  439. # LDAP Bind User Password
  440. LDAP_BIND_PASSWORD = None
  441. # OR ####################
  442. # 2. Anonymous Binding
  443. # Set this parameter to allow the anonymous bind.
  444. # After the connection is made, the pgadmin login user will be further
  445. # authenticated by the username and password provided
  446. LDAP_ANONYMOUS_BIND = False
  447. # OR ####################
  448. # 3. Bind as pgAdmin user
  449. # BaseDN (REQUIRED)
  450. # AD example:
  451. # (&(objectClass=user)(memberof=CN=MYGROUP,CN=Users,dc=example,dc=com))
  452. # OpenLDAP example: CN=Users,dc=example,dc=com
  453. LDAP_BASE_DN = '<Base-DN>'
  454. ##########################################################################
  455. # Search ldap for further authentication (REQUIRED)
  456. # It can be optional while bind as pgAdmin user
  457. LDAP_SEARCH_BASE_DN = '<Search-Base-DN>'
  458. # Filter string for the user search.
  459. # For OpenLDAP, '(cn=*)' may well be enough.
  460. # For AD, you might use '(objectClass=user)' (REQUIRED)
  461. LDAP_SEARCH_FILTER = '(objectclass=*)'
  462. # Search scope for users (one of BASE, LEVEL or SUBTREE)
  463. LDAP_SEARCH_SCOPE = 'SUBTREE'
  464. # Use TLS? If the URI scheme is ldaps://, this is ignored.
  465. LDAP_USE_STARTTLS = False
  466. # TLS/SSL certificates. Specify if required, otherwise leave empty
  467. LDAP_CA_CERT_FILE = ''
  468. LDAP_CERT_FILE = ''
  469. LDAP_KEY_FILE = ''
  470. ##########################################################################
  471. # Local config settings
  472. ##########################################################################
  473. # Load distribution-specific config overrides
  474. try:
  475. from config_distro import *
  476. except ImportError:
  477. pass
  478. # Load local config overrides
  479. try:
  480. from config_local import *
  481. except ImportError:
  482. pass
  483. # Load system config overrides. We do this last, so that the sysadmin can
  484. # override anything they want from a config file that's in a protected system
  485. # directory and away from pgAdmin to avoid invalidating signatures.
  486. system_config_dir = '/etc/pgadmin'
  487. if sys.platform.startswith('win32'):
  488. system_config_dir = os.environ['CommonProgramFiles'] + '/pgadmin'
  489. elif sys.platform.startswith('darwin'):
  490. system_config_dir = '/Library/Preferences/pgadmin'
  491. if os.path.exists(system_config_dir + '/config_system.py'):
  492. try:
  493. sys.path.insert(0, system_config_dir)
  494. from config_system import *
  495. except ImportError:
  496. pass
  497. # Override DEFAULT_SERVER value from environment variable.
  498. if 'PGADMIN_CONFIG_DEFAULT_SERVER' in os.environ:
  499. DEFAULT_SERVER = os.environ['PGADMIN_CONFIG_DEFAULT_SERVER']
  500. # Disable USER_INACTIVITY_TIMEOUT when SERVER_MODE=False
  501. if not SERVER_MODE:
  502. USER_INACTIVITY_TIMEOUT = 0