config_local.py.j2 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610
  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 = 5
  41. APP_REVISION = 0
  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 = 50000
  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",
  149. "text/css",
  150. "text/xml",
  151. "application/json",
  152. "application/javascript",
  153. ]
  154. COMPRESS_LEVEL = 9
  155. COMPRESS_MIN_SIZE = 500
  156. # Set the cache control max age for static files in flask to 1 year
  157. SEND_FILE_MAX_AGE_DEFAULT = 31556952
  158. # This will be added to static urls as url parameter with value as
  159. # APP_VERSION_INT for cache busting on version upgrade. If the value is set as
  160. # None or empty string then it will not be added.
  161. # eg - http:localhost:5050/pgadmin.css?intver=3.13
  162. APP_VERSION_PARAM = "ver"
  163. # Add the internal version param to below extensions only
  164. APP_VERSION_EXTN = (".css", ".js", ".html", ".svg", ".png", ".gif", ".ico")
  165. # Data directory for storage of config settings etc. This shouldn't normally
  166. # need to be changed - it's here as various other settings depend on it.
  167. # On Windows, we always store data in %APPDATA%\pgAdmin. On other platforms,
  168. # if we're in server mode we use /var/lib/pgadmin, otherwise ~/.pgadmin
  169. if IS_WIN:
  170. # Use the short path on windows
  171. DATA_DIR = os.path.realpath(os.path.join(fs_short_path(env("APPDATA")), u"pgAdmin"))
  172. else:
  173. if SERVER_MODE:
  174. DATA_DIR = "/usr/local/lib/pgadmin"
  175. else:
  176. DATA_DIR = os.path.realpath(os.path.expanduser(u"~/.pgadmin/"))
  177. # An optional login banner to show security warnings/disclaimers etc. at
  178. # login and password recovery etc. HTML may be included for basic formatting,
  179. # For example:
  180. # LOGIN_BANNER = "<h4>Authorised Users Only!</h4>" \
  181. # "Unauthorised use is strictly forbidden."
  182. LOGIN_BANNER = ""
  183. ##########################################################################
  184. # Log settings
  185. ##########################################################################
  186. # Debug mode?
  187. DEBUG = False
  188. # Application log level - one of:
  189. # CRITICAL 50
  190. # ERROR 40
  191. # WARNING 30
  192. # SQL 25
  193. # INFO 20
  194. # DEBUG 10
  195. # NOTSET 0
  196. CONSOLE_LOG_LEVEL = logging.WARNING
  197. FILE_LOG_LEVEL = logging.WARNING
  198. # Log format.
  199. CONSOLE_LOG_FORMAT = "%(asctime)s: %(levelname)s\t%(name)s:\t%(message)s"
  200. FILE_LOG_FORMAT = "%(asctime)s: %(levelname)s\t%(name)s:\t%(message)s"
  201. # Log file name. This goes in the data directory, except on non-Windows
  202. # platforms in server mode.
  203. if SERVER_MODE and not IS_WIN:
  204. LOG_FILE = "/var/log/pgadmin/pgadmin4.log"
  205. else:
  206. LOG_FILE = os.path.join(DATA_DIR, "pgadmin4.log")
  207. ##########################################################################
  208. # Server Connection Driver Settings
  209. ##########################################################################
  210. # The default driver used for making connection with PostgreSQL
  211. PG_DEFAULT_DRIVER = "psycopg2"
  212. # Maximum allowed idle time in minutes before which releasing the connection
  213. # for the particular session. (in minutes)
  214. MAX_SESSION_IDLE_TIME = 60
  215. ##########################################################################
  216. # User account and settings storage
  217. ##########################################################################
  218. # The default path to the SQLite database used to store user accounts and
  219. # settings. This default places the file in the same directory as this
  220. # config file, but generates an absolute path for use througout the app.
  221. SQLITE_PATH = env("SQLITE_PATH") or os.path.join(DATA_DIR, "pgadmin4.db")
  222. # SQLITE_TIMEOUT will define how long to wait before throwing the error -
  223. # OperationError due to database lock. On slower system, you may need to change
  224. # this to some higher value.
  225. # (Default: 500 milliseconds)
  226. SQLITE_TIMEOUT = 500
  227. # Allow database connection passwords to be saved if the user chooses.
  228. # Set to False to disable password saving.
  229. ALLOW_SAVE_PASSWORD = True
  230. # Maximum number of history queries stored per user/server/database
  231. MAX_QUERY_HIST_STORED = 20
  232. ##########################################################################
  233. # Server-side session storage path
  234. #
  235. # SESSION_DB_PATH (Default: $HOME/.pgadmin4/sessions)
  236. ##########################################################################
  237. #
  238. # We use SQLite for server-side session storage. There will be one
  239. # SQLite database object per session created.
  240. #
  241. # Specify the path used to store your session objects.
  242. #
  243. # If the specified directory does not exist, the setup script will create
  244. # it with permission mode 700 to keep the session database secure.
  245. #
  246. # On certain systems, you can use shared memory (tmpfs) for maximum
  247. # scalability, for example, on Ubuntu:
  248. #
  249. # SESSION_DB_PATH = '/run/shm/pgAdmin4_session'
  250. #
  251. ##########################################################################
  252. SESSION_DB_PATH = os.path.join(DATA_DIR, "sessions")
  253. SESSION_COOKIE_NAME = "pga4_session"
  254. ##########################################################################
  255. # Mail server settings
  256. ##########################################################################
  257. # These settings are used when running in web server mode for confirming
  258. # and resetting passwords etc.
  259. # See: http://pythonhosted.org/Flask-Mail/ for more info
  260. MAIL_SERVER = "box.unbl.ink"
  261. MAIL_PORT = 587
  262. MAIL_USE_SSL = True
  263. MAIL_USE_TLS = False
  264. MAIL_USERNAME = "services@unbl.ink"
  265. MAIL_PASSWORD = "{{services_unblink_email_pass}}"
  266. MAIL_DEBUG = False
  267. # Flask-Security overrides Flask-Mail's MAIL_DEFAULT_SENDER setting, so
  268. # that should be set as such:
  269. SECURITY_EMAIL_SENDER = "no-reply@localhost"
  270. ##########################################################################
  271. # Mail content settings
  272. ##########################################################################
  273. # These settings define the content of password reset emails
  274. SECURITY_EMAIL_SUBJECT_PASSWORD_RESET = "Password reset instructions for %s" % APP_NAME
  275. SECURITY_EMAIL_SUBJECT_PASSWORD_NOTICE = "Your %s password has been reset" % APP_NAME
  276. SECURITY_EMAIL_SUBJECT_PASSWORD_CHANGE_NOTICE = (
  277. "Your password for %s has been changed" % APP_NAME
  278. )
  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__)), "cacert.pem")
  291. # Check if the detected browser is supported
  292. CHECK_SUPPORTED_BROWSER = False
  293. ##########################################################################
  294. # Storage Manager storage url config settings
  295. # If user sets STORAGE_DIR to empty it will show all volumes if platform
  296. # is Windows, '/' if it is Linux, Mac or any other unix type system.
  297. # For example:
  298. # 1. STORAGE_DIR = get_drive("C") or get_drive() # return C:/ by default
  299. # where C can be any drive character such as "D", "E", "G" etc
  300. # 2. Set path manually like
  301. # STORAGE_DIR = "/path/to/directory/"
  302. ##########################################################################
  303. STORAGE_DIR = os.path.join(DATA_DIR, "storage")
  304. ##########################################################################
  305. # Default locations for binary utilities (pg_dump, pg_restore etc)
  306. #
  307. # These are intentionally left empty in the main config file, but are
  308. # expected to be overridden by packagers in config_distro.py.
  309. #
  310. # A default location can be specified for each database driver ID, in
  311. # a dictionary. Either an absolute or relative path can be specified.
  312. # In cases where it may be difficult to know what the working directory
  313. # is, "$DIR" can be specified. This will be replaced with the path to the
  314. # top-level pgAdmin4.py file. For example, on macOS we might use:
  315. #
  316. # $DIR/../../SharedSupport
  317. #
  318. ##########################################################################
  319. DEFAULT_BINARY_PATHS = {"pg": "", "ppas": "", "gpdb": ""}
  320. ##########################################################################
  321. # Test settings - used primarily by the regression suite, not for users
  322. ##########################################################################
  323. # The default path for SQLite database for testing
  324. TEST_SQLITE_PATH = os.path.join(DATA_DIR, "test_pgadmin4.db")
  325. ##########################################################################
  326. # Allows flask application to response to the each request asynchronously
  327. ##########################################################################
  328. THREADED_MODE = True
  329. ##########################################################################
  330. # Do not allow SQLALCHEMY to track modification as it is going to be
  331. # deprecated in future
  332. ##########################################################################
  333. SQLALCHEMY_TRACK_MODIFICATIONS = False
  334. ##########################################################################
  335. # Number of records to fetch in one batch in query tool when query result
  336. # set is large.
  337. ##########################################################################
  338. ON_DEMAND_RECORD_COUNT = 1000
  339. ##########################################################################
  340. # Allow users to display Gravatar image for their username in Server mode
  341. ##########################################################################
  342. SHOW_GRAVATAR_IMAGE = True
  343. ##########################################################################
  344. # Set cookie path
  345. ##########################################################################
  346. COOKIE_DEFAULT_PATH = "/"
  347. COOKIE_DEFAULT_DOMAIN = None
  348. SESSION_COOKIE_DOMAIN = None
  349. SESSION_COOKIE_SAMESITE = "Lax"
  350. #########################################################################
  351. # Skip storing session in files and cache for specific paths
  352. #########################################################################
  353. SESSION_SKIP_PATHS = ["/misc/ping"]
  354. ##########################################################################
  355. # Session expiration support
  356. ##########################################################################
  357. # SESSION_EXPIRATION_TIME is the interval in Days. Session will be
  358. # expire after the specified number of *days*.
  359. SESSION_EXPIRATION_TIME = 1
  360. # CHECK_SESSION_FILES_INTERVAL is interval in Hours. Application will check
  361. # the session files for cleanup after specified number of *hours*.
  362. CHECK_SESSION_FILES_INTERVAL = 24
  363. # USER_INACTIVITY_TIMEOUT is interval in Seconds. If the pgAdmin screen is left
  364. # unattended for <USER_INACTIVITY_TIMEOUT> seconds then the user will
  365. # be logged out. When set to 0, the timeout will be disabled.
  366. # If pgAdmin doesn't detect any activity in the time specified (in seconds),
  367. # the user will be forcibly logged out from pgAdmin. Set to zero to disable
  368. # the timeout.
  369. # Note: This is applicable only for SERVER_MODE=True.
  370. USER_INACTIVITY_TIMEOUT = 0
  371. # OVERRIDE_USER_INACTIVITY_TIMEOUT when set to True will override
  372. # USER_INACTIVITY_TIMEOUT when long running queries in the Query Tool
  373. # or Debugger are running. When the queries complete, the inactivity timer
  374. # will restart in this case. If set to False, user inactivity may cause
  375. # transactions or in-process debugging sessions to be aborted.
  376. OVERRIDE_USER_INACTIVITY_TIMEOUT = True
  377. ##########################################################################
  378. # SSH Tunneling supports only for Python 2.7 and 3.4+
  379. ##########################################################################
  380. SUPPORT_SSH_TUNNEL = True
  381. # Allow SSH Tunnel passwords to be saved if the user chooses.
  382. # Set to False to disable password saving.
  383. ALLOW_SAVE_TUNNEL_PASSWORD = False
  384. ##########################################################################
  385. # Master password is used to encrypt/decrypt saved server passwords
  386. # Applicable for desktop mode only
  387. ##########################################################################
  388. MASTER_PASSWORD_REQUIRED = True
  389. ##########################################################################
  390. # Allows pgAdmin4 to create session cookies based on IP address, so even
  391. # if a cookie is stolen, the attacker will not be able to connect to the
  392. # server using that stolen cookie.
  393. # Note: This can cause problems when the server is deployed in dynamic IP
  394. # address hosting environments, such as Kubernetes or behind load
  395. # balancers. In such cases, this option should be set to False.
  396. ##########################################################################
  397. ENHANCED_COOKIE_PROTECTION = True
  398. ##########################################################################
  399. # External Authentication Sources
  400. ##########################################################################
  401. # Default setting is internal
  402. # External Supported Sources: ldap
  403. # Multiple authentication can be achieved by setting this parameter to
  404. # ['ldap', 'internal']. pgAdmin will authenticate the user with ldap first,
  405. # in case of failure internal authentication will be done.
  406. AUTHENTICATION_SOURCES = ["internal"]
  407. ##########################################################################
  408. # LDAP Configuration
  409. ##########################################################################
  410. # After ldap authentication, user will be added into the SQLite database
  411. # automatically, if set to True.
  412. # Set it to False, if user should not be added automatically,
  413. # in this case Admin has to add the user manually in the SQLite database.
  414. LDAP_AUTO_CREATE_USER = True
  415. # Connection timeout
  416. LDAP_CONNECTION_TIMEOUT = 10
  417. # Server connection details (REQUIRED)
  418. # example: ldap://<ip-address>:<port> or ldap://<hostname>:<port>
  419. LDAP_SERVER_URI = "ldap://<ip-address>:<port>"
  420. # The LDAP attribute containing user names. In OpenLDAP, this may be 'uid'
  421. # whilst in AD, 'sAMAccountName' might be appropriate. (REQUIRED)
  422. LDAP_USERNAME_ATTRIBUTE = "<User-id>"
  423. ##########################################################################
  424. # 3 ways to configure LDAP as follows (Choose anyone):
  425. # 1. Dedicated User binding
  426. # LDAP Bind User DN Example: cn=username,dc=example,dc=com
  427. # Set this parameter to allow the connection to bind using a dedicated user.
  428. # After the connection is made, the pgadmin login user will be further
  429. # authenticated by the username and password provided
  430. # at the login screen.
  431. LDAP_BIND_USER = None
  432. # LDAP Bind User Password
  433. LDAP_BIND_PASSWORD = None
  434. # OR ####################
  435. # 2. Anonymous Binding
  436. # Set this parameter to allow the anonymous bind.
  437. # After the connection is made, the pgadmin login user will be further
  438. # authenticated by the username and password provided
  439. LDAP_ANONYMOUS_BIND = False
  440. # OR ####################
  441. # 3. Bind as pgAdmin user
  442. # BaseDN (REQUIRED)
  443. # AD example:
  444. # (&(objectClass=user)(memberof=CN=MYGROUP,CN=Users,dc=example,dc=com))
  445. # OpenLDAP example: CN=Users,dc=example,dc=com
  446. LDAP_BASE_DN = "<Base-DN>"
  447. ##########################################################################
  448. # Search ldap for further authentication (REQUIRED)
  449. # It can be optional while bind as pgAdmin user
  450. LDAP_SEARCH_BASE_DN = "<Search-Base-DN>"
  451. # Filter string for the user search.
  452. # For OpenLDAP, '(cn=*)' may well be enough.
  453. # For AD, you might use '(objectClass=user)' (REQUIRED)
  454. LDAP_SEARCH_FILTER = "(objectclass=*)"
  455. # Search scope for users (one of BASE, LEVEL or SUBTREE)
  456. LDAP_SEARCH_SCOPE = "SUBTREE"
  457. # Use TLS? If the URI scheme is ldaps://, this is ignored.
  458. LDAP_USE_STARTTLS = False
  459. # TLS/SSL certificates. Specify if required, otherwise leave empty
  460. LDAP_CA_CERT_FILE = ""
  461. LDAP_CERT_FILE = ""
  462. LDAP_KEY_FILE = ""
  463. ##########################################################################
  464. # Local config settings
  465. ##########################################################################
  466. # Load distribution-specific config overrides
  467. try:
  468. from config_distro import *
  469. except ImportError:
  470. pass
  471. # Load local config overrides
  472. try:
  473. from config_local import *
  474. except ImportError:
  475. pass
  476. # Load system config overrides. We do this last, so that the sysadmin can
  477. # override anything they want from a config file that's in a protected system
  478. # directory and away from pgAdmin to avoid invalidating signatures.
  479. system_config_dir = "/etc/pgadmin"
  480. if sys.platform.startswith("win32"):
  481. system_config_dir = os.environ["CommonProgramFiles"] + "/pgadmin"
  482. elif sys.platform.startswith("darwin"):
  483. system_config_dir = "/Library/Preferences/pgadmin"
  484. if os.path.exists(system_config_dir + "/config_system.py"):
  485. try:
  486. sys.path.insert(0, system_config_dir)
  487. from config_system import *
  488. except ImportError:
  489. pass
  490. # Override DEFAULT_SERVER value from environment variable.
  491. if "PGADMIN_CONFIG_DEFAULT_SERVER" in os.environ:
  492. DEFAULT_SERVER = os.environ["PGADMIN_CONFIG_DEFAULT_SERVER"]
  493. # Disable USER_INACTIVITY_TIMEOUT when SERVER_MODE=False
  494. if not SERVER_MODE:
  495. USER_INACTIVITY_TIMEOUT = 0