Repository: rickbergfalk/sqlpad
Pull request #767 (2020-07-05 21:39:00)

Deprecate INI & JSON config files
Deprecates INI & JSON config files, and removes most examples/references to the `keyName` config variables. The documentation listing the variables has not changed... Will likely simplify and split the key vs env documentation. 

I realized a potential hassle with all this is that connection ids could have had a dash in them when defined via JSON, but not when they are defined via ENV. 

Might need a migration to convert connection ids replacing `-` with `_` if this is problematic for anyone.


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6512030c..dee58f8c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,10 @@
 # Changelog
 
+## [5.1.0] - 2020-??-??
+
+- Add .env config file support
+- Deprecate INI and JSON config files support
+
 ## [5.0.0] - 2020-07-03
 
 Version 5 contains many infrastructure and API changes, as well as migrations that are not easy to roll back from. It is highly recommended take a backup of your database (`SQLPAD_DB_PATH` directory and/or your backend db in use).
diff --git a/DEVELOPER-GUIDE.md b/DEVELOPER-GUIDE.md
index 2651f4ba..d4e2e346 100644
--- a/DEVELOPER-GUIDE.md
+++ b/DEVELOPER-GUIDE.md
@@ -44,7 +44,7 @@ At this point you can run the SQLPad server with the front-end built for product
 
 ```sh
 cd server
-node server.js --dbPath ../db --port 3010
+node server.js --config ./config.dev.env
 ```
 
 If prefered, SQLPad can be installed as a global module using the local files in this repo. This allows running SQLPad via the cli in any directory, just as if you had installed it with `npm install sqlpad -g`. Note that you must build and copy the client prior to this step.
@@ -55,7 +55,7 @@ npm install -g
 
 # Now from somewhere else you can run sqlpad like
 cd ~
-sqlpad --dbPath ../db --port 3010
+sqlpad --config ./config.dev.env
 ```
 
 If sqlpad was installed globally via npm from npm, you may need to run `npm uninstall sqlpad -g`.
diff --git a/config-example.ini b/config-example.ini
deleted file mode 100644
index 58274458..00000000
--- a/config-example.ini
+++ /dev/null
@@ -1,174 +0,0 @@
-; Email address to give admin permissions to
-admin=""
-
-; Password to set for admin email address on application start. Requires `admin` setting to also be provided.
-adminPassword=""
-
-; Enable csv, json and xlsx downloads.
-allowCsvDownload="true"
-
-; Allows pre-approval of email domains. Delimit multiple domains by empty space.
-allowedDomains=""
-
-; Path to mount sqlpad app following domain. Example, if '/sqlpad' is provided queries page would be mydomain.com/sqlpad/queries
-baseUrl=""
-
-; Passphrase for your SSL certification file
-certPassphrase=""
-
-; Absolute path to where SSL certificate is stored
-certPath=""
-
-; Name used for cookie. If running multiple SQLPads on same domain, set to different values
-cookieName="sqlpad.sid"
-
-; Secret used to sign cookies
-cookieSecret="secret-used-to-sign-cookies-please-set-and-make-strong"
-
-; Enable/disable automigration on SQLPad process start. Disable by setting to `false`
-dbAutomigrate="true"
-
-; Directory to store SQLPad embedded database content. This includes queries, users, query result cache files, etc.
-dbPath=""
-
-; Default connection to select on SQLPad load if connection not previousy selected.
-defaultConnectionId=''
-
-; Set to TRUE to disable authentication altogether.
-disableAuth="false"
-
-; Specifies the role associated with users when disableAuth is set to true.
-; Acceptable values: admin, editor
-disableAuthDefaultRole="editor"
-
-; Set to TRUE to disable built-in user authentication. Use to restrict auth to OAuth only.
-disableUserpassAuth="false"
-
-; Set to TRUE if LDAP enable, FALSE if LDAP disable.
-enableLdapAuth="false"
-
-; LDAP URL, ldap and ldaps protocols are supported.
-ldapUrl=""
-
-; Base LDAP DN to search for users in.
-ldapBaseDN=""
-
-; The bind user will be used to lookup information about other LDAP users.
-ldapUsername=""
-
-; The password to bind with for the lookup user.
-ldapPassword=""
-
-; Enable word wrapping in SQL editor.
-editorWordWrap="false"
-
-; Google Client ID used for OAuth setup. Authorized redirect URI for sqlpad is '[baseurl]/auth/google/callback'
-googleClientId=""
-
-; Google Client Secret used for OAuth setup. Authorized redirect URI for sqlpad is '[baseurl]/auth/google/callback'
-googleClientSecret=""
-
-; Port for SQLPad to listen on.
-httpsPort="443"
-
-; IP address to bind to. By default SQLPad will listen from all available addresses (0.0.0.0).
-ip="0.0.0.0"
-
-; Absolute path to where SSL certificate key is stored
-keyPath=""
-
-; A string of text used to encrypt sensitive values when stored on disk.
-passphrase="At least the sensitive bits won't be plain text?"
-
-; Port for SQLPad to listen on.
-port="80"
-
-; Public URL used for OAuth setup and email links. Protocol expected. Example: https://mysqlpad.com
-publicUrl=""
-
-; By default query results are limited to 50,000 records.
-queryResultMaxRows="50000"
-
-; SAML authentication - provide HTML for the sign-in link.
-samlLinkHtml=""
-
-; Auto create a user record if it does not exist when new user is detected via SAML authentication
-samlAutoSignUp=false
-
-; Default role to assign user created when `samlAutoSignUp` is turned on. 
-; By default this is an empty-string and not used, expecting a role to be provided via header-mapping.
-samlDefaultRole=""
-
-; SAML authentication context URL
-samlAuthContext=""
-
-; SAML callback URL
-samlCallbackUrl=""
-
-; SAML certificate in Base64
-samlCert=""
-
-; SAML Entry point URL
-samlEntryPoint=""
-
-; SAML Issuer
-samlIssuer=""
-
-; Minutes to keep a session active. Will extended by this amount each request.
-sessionMinutes="60"
-
-; Supply incoming Slack webhook URL to post query when saved.
-slackWebhook=""
-
-; From email address for SMTP. Required in order to send invitation emails.
-smtpFrom=""
-
-; Host address for SMTP. Required in order to send invitation emails.
-smtpHost=""
-
-; Password for SMTP.
-smtpPassword=""
-
-; Port for SMTP. Required in order to send invitation emails.
-smtpPort=""
-
-; Toggle to use secure connection when using SMTP.
-smtpSecure="true"
-
-; Username for SMTP. Required in order to send invitation emails.
-smtpUser=""
-
-; Acquire socket from systemd if available
-systemdSocket="false"
-
-; HTTP server timeout as number of seconds. Extend as necessary for long running queries
-timeoutSeconds=300
-
-; Minimum level for app logs. Should be one of 'fatal', 'error', 'warn', 'info', 'debug', 'trace' or 'silent'.
-appLogLevel="info"
-
-; Minimum level for web logs. Should be one of 'fatal', 'error', 'warn', 'info', 'debug', 'trace' or 'silent'.
-webLogLevel="info"
-
-; Path to root of seed data directories
-seedDataPath=""
-
-; Enable auth proxy authentication
-authProxyEnabled=false
-
-; Auto create a user record if it does not exist when new user is detected via auth proxy
-authProxyAutoSignUp=false
-
-; Default role to assign user created when `authProxyAutoSignUp` is turned on. 
-; By default this is an empty-string and not used, expecting a role to be provided via header-mapping.
-authProxyDefaultRole=""
-
-; Space-delimited field:header mappings to use to derive user information from HTTP headers. 
-; A mapping to `email` is required at a minimum assuming `authProxyDefaultRole` is set. 
-; Otherwise `role`, `id`, `name` and `data.<customField>` fields may be set.
-;
-; When supplying both `id` and `email`, `id` will be used for user matching instead of `email`, 
-; updating SQLPad user `email` fields when they change (assuming `id` is not changing).
-; 
-; Example: "id:X-WEBAUTH-ID email:X-WEBAUTH-EMAIL name:X-WEBAUTH-NAME role:X-WEBAUTH-ROLE data.customField:X-WEBAUTH-CUSTOM-FIELD"
-authProxyHeaders=""
diff --git a/config-example.json b/config-example.json
deleted file mode 100644
index 444becc5..00000000
--- a/config-example.json
+++ /dev/null
@@ -1,52 +0,0 @@
-{
-  "admin": "",
-  "adminPassword": "",
-  "allowCsvDownload": true,
-  "allowedDomains": "",
-  "baseUrl": "",
-  "certPassphrase": "",
-  "certPath": "",
-  "cookieName": "sqlpad.sid",
-  "cookieSecret": "secret-used-to-sign-cookies-please-set-and-make-strong",
-  "dbAutomigrate": true,
-  "dbPath": "",
-  "defaultConnectionId": "",
-  "disableAuth": false,
-  "disableAuthDefaultRole": "editor",
-  "disableUserpassAuth": false,
-  "editorWordWrap": false,
-  "googleClientId": "",
-  "googleClientSecret": "",
-  "httpsPort": 443,
-  "ip": "0.0.0.0",
-  "keyPath": "",
-  "passphrase": "At least the sensitive bits won't be plain text?",
-  "port": 80,
-  "publicUrl": "",
-  "queryResultMaxRows": 50000,
-  "samlLinkHtml": "",
-  "samlAutoSignUp": false,
-  "samlDefaultRole": "",
-  "samlAuthContext": "",
-  "samlCallbackUrl": "",
-  "samlCert": "",
-  "samlEntryPoint": "",
-  "samlIssuer": "",
-  "sessionMinutes": 60,
-  "slackWebhook": "",
-  "smtpFrom": "",
-  "smtpHost": "",
-  "smtpPassword": "",
-  "smtpPort": "",
-  "smtpSecure": true,
-  "smtpUser": "",
-  "systemdSocket": false,
-  "timeoutSeconds": 300,
-  "appLogLevel": "info",
-  "webLogLevel": "info",
-  "seedDataPath": "",
-  "authProxyEnabled": false,
-  "authProxyAutoSignUp": false,
-  "authProxyDefaultRole": "",
-  "authProxyHeaders": ""
-}
diff --git a/docker-examples/mssql-docker-compose/README.md b/docker-examples/mssql-docker-compose/README.md
deleted file mode 100644
index 55763209..00000000
--- a/docker-examples/mssql-docker-compose/README.md
+++ /dev/null
@@ -1,35 +0,0 @@
-# mssql (Microsoft SQL Server)
-
-This assumes you have docker installed with docker compose, and some light understanding of docker
-
-When trying out the mssql test, be sure your docker environment meets minimum reqs: https://hub.docker.com/r/microsoft/mssql-server-linux/
-
-```sh
-cd mssql
-
-# this puts docker compose things into background
-docker-compose up -d
-
-# If you'd like to create a database, connect to docker to create db
-# otherwise you can use `master`
-docker exec -it mssql_mssql_1 /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P SuperP4ssw0rd!
-
-# In next prompt run following
-# 1> CREATE DATABASE mssqltest;
-# 2> GO
-# ctrl-c to quit
-
-# (optional) follow logs from docker
-docker-compose logs -f
-```
-
-Go to localhost:3000 in browser. Sign up, sign in.
-
-Create SQL Server connection with following:
-
-```
-host: mssql
-database: master (or created db)
-user: sa
-password: SuperP4ssw0rd!
-```
diff --git a/docker-examples/mssql-docker-compose/config.json b/docker-examples/mssql-docker-compose/config.json
deleted file mode 100644
index e0fb4d7e..00000000
--- a/docker-examples/mssql-docker-compose/config.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
-  "admin": "admin@sqlpad.com",
-  "adminPassword": "admin",
-  "appLogLevel": "info",
-  "webLogLevel": "warn",
-  "connections": {
-    "sql-server-demo": {
-      "name": "sql server demo",
-      "driver": "sqlserver",
-      "host": "mssql",
-      "database": "master",
-      "username": "sa",
-      "password": "SuperP4ssw0rd!"
-    }
-  }
-}
diff --git a/docker-examples/mssql-docker-compose/docker-compose.yml b/docker-examples/mssql-docker-compose/docker-compose.yml
index 2a43b43f..905c04cc 100644
--- a/docker-examples/mssql-docker-compose/docker-compose.yml
+++ b/docker-examples/mssql-docker-compose/docker-compose.yml
@@ -10,16 +10,25 @@ services:
       - MSSQL_SA_PASSWORD=SuperP4ssw0rd!
       - MSSQL_PID=Express
   sqlpad:
-    # Use Dockerfile at root of this project
-    build: ../../
+    # To use Dockerfile at root of this project, use build instead of image
+    # build: ../../
+    image: sqlpad/sqlpad:5
     hostname: 'sqlpad'
     ports:
       - '3000:3000'
     environment:
-      SQLPAD_CONFIG: /etc/sqlpad/config.json
+      SQLPAD_ADMIN: 'admin@sqlpad.com'
+      SQLPAD_ADMIN_PASSWORD: 'admin'
+      SQLPAD_APP_LOG_LEVEL: info
+      SQLPAD_WEB_LOG_LEVEL: warn
+      SQLPAD_CONNECTIONS__sqlserverdemo__name: SQL Server Demo
+      SQLPAD_CONNECTIONS__sqlserverdemo__driver: sqlserver
+      SQLPAD_CONNECTIONS__sqlserverdemo__host: mssql
+      SQLPAD_CONNECTIONS__sqlserverdemo__database: master
+      SQLPAD_CONNECTIONS__sqlserverdemo__username: sa
+      SQLPAD_CONNECTIONS__sqlserverdemo__password: SuperP4ssw0rd!
     volumes:
       - sqlpad-volume:/var/lib/sqlpad
-      - ./config.json:/etc/sqlpad/config.json
 
 volumes:
   sqlpad-volume:
diff --git a/docker-examples/postgres-docker-compose/README.md b/docker-examples/postgres-docker-compose/README.md
index 9ee7ab98..fc6327de 100644
--- a/docker-examples/postgres-docker-compose/README.md
+++ b/docker-examples/postgres-docker-compose/README.md
@@ -8,7 +8,7 @@ Open command line in this directory containing the docker-compose file then type
 # pull/download docker images in compose file
 docker-compose pull
 
-# Because sqlpad uses a docker file instead of an image on docker hub, it must be built
+# If using `build` instead of `image` build the SQLPad image
 docker-compose build
 
 # Then to start sqlpad and postgres do
@@ -18,32 +18,3 @@ docker-compose up
 When the containers are up and running you'll have postgres and sqlpad running, with sqlpad mapped to local port 3000.
 
 Open a browser tab and to go `http://localhost:3000`.
-
-Click on "sign up" and enter in an email and password you desire for your SQLPad admin account. Then sign in.
-
-Once logged into SQLPad, you can create a connection to the postgres instance inside the docker compose network. Click the three-dot icon on upper right, click `Connections` then `Add connections`.
-
-Input the following:
-
-- Name: anything you'd like to identify the connection
-- Driver: Postgres
-- Host: `db` (this is the service name inside docker-compose file)
-- Database: `sqlpad` (automatically created because of POSTGRES_USER env variable)
-- Database username: `sqlpad`
-- Database password: `sqlpad`
-
-At this point you can ensure the connection succeeds by clicking `Test`. A green check mark will appear on button if successful.
-
-Click save.
-
-You can now select the connection in the main query editor interface. And run some SQL:
-
-```sql
-create table test (id int, words text);
-
-insert into test values (1, 'hello'), (2, 'sqlpad');
-
-select * from test;
-```
-
-Add more connections to other databases.
diff --git a/docker-examples/postgres-docker-compose/config.json b/docker-examples/postgres-docker-compose/config.json
deleted file mode 100644
index 72162047..00000000
--- a/docker-examples/postgres-docker-compose/config.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
-  "admin": "admin@sqlpad.com",
-  "adminPassword": "admin",
-  "appLogLevel": "info",
-  "webLogLevel": "warn",
-  "seedDataPath": "/etc/sqlpad/seed-data",
-  "connections": {
-    "pg-demo": {
-      "name": "Postgres demo",
-      "driver": "postgres",
-      "host": "postgres",
-      "database": "sqlpad",
-      "username": "sqlpad",
-      "password": "sqlpad",
-      "multiStatementTransactionEnabled": true,
-      "idleTimeoutSeconds": 86400
-    }
-  }
-}
diff --git a/docker-examples/postgres-docker-compose/docker-compose.yml b/docker-examples/postgres-docker-compose/docker-compose.yml
index e235a022..ad60720b 100644
--- a/docker-examples/postgres-docker-compose/docker-compose.yml
+++ b/docker-examples/postgres-docker-compose/docker-compose.yml
@@ -10,13 +10,25 @@ services:
       - ./docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
 
   sqlpad:
-    # Use Dockerfile at root of this project
-    build: ../../
+    # To use Dockerfile at root of this project, use build instead of image
+    # build: ../../
+    image: sqlpad/sqlpad:5
     hostname: 'sqlpad'
     ports:
       - '3000:3000'
     environment:
-      SQLPAD_CONFIG: /etc/sqlpad/config.json
+      SQLPAD_ADMIN: 'admin@sqlpad.com'
+      SQLPAD_ADMIN_PASSWORD: 'admin'
+      SQLPAD_APP_LOG_LEVEL: debug
+      SQLPAD_WEB_LOG_LEVEL: warn
+      SQLPAD_SEED_DATA_PATH: /etc/sqlpad/seed-data
+      SQLPAD_CONNECTIONS__pgdemo__name: Postgres demo
+      SQLPAD_CONNECTIONS__pgdemo__driver: postgres
+      SQLPAD_CONNECTIONS__pgdemo__host: postgres
+      SQLPAD_CONNECTIONS__pgdemo__database: sqlpad
+      SQLPAD_CONNECTIONS__pgdemo__username: sqlpad
+      SQLPAD_CONNECTIONS__pgdemo__password: sqlpad
+      SQLPAD_CONNECTIONS__pgdemo__multiStatementTransactionEnabled: 'true'
+      SQLPAD_CONNECTIONS__pgdemo__idleTimeoutSeconds: 86400
     volumes:
-      - ./config.json:/etc/sqlpad/config.json
       - ./seed-data:/etc/sqlpad/seed-data
diff --git a/docker-examples/postgres-docker-compose/seed-data/queries/query-1.json b/docker-examples/postgres-docker-compose/seed-data/queries/query-1.json
index 2164f2b8..f0c9611b 100644
--- a/docker-examples/postgres-docker-compose/seed-data/queries/query-1.json
+++ b/docker-examples/postgres-docker-compose/seed-data/queries/query-1.json
@@ -1,7 +1,7 @@
 {
   "id": "seed-query-1",
   "name": "Seed query 1",
-  "connectionId": "pg-demo",
+  "connectionId": "pgdemo",
   "queryText": "SELECT * FROM some_table",
   "createdBy": "admin@sqlpad.com",
   "acl": [
diff --git a/docker-examples/postgres-docker-compose/seed-data/queries/query-2.json b/docker-examples/postgres-docker-compose/seed-data/queries/query-2.json
index 11facb87..7adb8a38 100644
--- a/docker-examples/postgres-docker-compose/seed-data/queries/query-2.json
+++ b/docker-examples/postgres-docker-compose/seed-data/queries/query-2.json
@@ -1,9 +1,9 @@
 {
   "id": "seed-query-2",
   "name": "Shared prebuilt query",
-  "connectionId": "pg-demo",
+  "connectionId": "pgdemo",
   "queryText": "-- This is a shared query by a user that does not exist\n\nSELECT * FROM test",
-  "createdBy": "not-real-user-but-that-is-okay-for-now@sqlpad.com",
+  "createdBy": "not-real-user@sqlpad.com",
   "acl": [
     {
       "groupId": "__EVERYONE__",
diff --git a/docs/authentication.md b/docs/authentication.md
index 14ee2742..c1adebd1 100644
--- a/docs/authentication.md
+++ b/docs/authentication.md
@@ -8,19 +8,17 @@ Once SQLPad is running, you may create an initial admin account by navigating to
 
 Once an initial admin account has been created, all future users must be added by an admin within the users page. Other users may also be given admin rights, allowing them to add/edit database connections and add/modify/remove SQLPad users.
 
-If for whatever reason you lose admin rights, and the last-admin-standing won't give you admin rights back, you can reinstate them to yourself by running
+If for whatever reason you lose admin rights, and the last-admin-standing won't give you admin rights back, you can reinstate them to yourself by setting environment variable `SQLPAD_ADMIN=yourEmailAddress@domain.com`.
 
-`sqlpad --admin yourEmailAddress@domain.com`
-
-Local authentication can be disabled by setting `disableUserpassAuth` to `true`.
+Local authentication can be disabled by setting `SQLPAD_DISABLE_USERPASS_AUTH=true`.
 
 ## No Authentication
 
 ?> Available as of `4.2.0`
 
-SQLPad can be configured to run without any authentication at all. This can be enabled by setting `disableAuth` to `true`.
+SQLPad can be configured to run without any authentication at all. This can be enabled by setting `DISABLE_AUTH` to `true`.
 
-If enabled, `disableAuthDefaultRole` is used to assign admin or editor role to users. You'd want to configure connections via configuration file or environment variables if `disableAuthDefaultRole` is `editor`.
+If enabled, `SQLPAD_DISABLE_AUTH_DEFAULT_ROLE` is used to assign admin or editor role to users. Set to `editor` if you want to restrict SQLPad to connections defined via configuration.
 
 ## Auth Proxy
 
@@ -32,9 +30,9 @@ An HTTP reverse proxy may be used to handle authentication as of SQLPad `4.2.0`
 
 In this setup a proxy handles authentication, passing headers to SQLPad that map to SQLPad user fields. Headers are mapped to user fields, using a space-delimited string using a `<fieldName>:<HEADER-NAME>` syntax.
 
-At a minimum, a user's `email` must be provided in the header mapping (assuming a default role is provided by `authProxyDefaultRole`). Role may otherwise be provided via a header mapping.
+At a minimum, a user's `email` must be provided in the header mapping (assuming a default role is provided by `SQLPAD_AUTH_PROXY_DEFAULT_ROLE`). Role may otherwise be provided via a header mapping.
 
-SQLPad users do not need to be added ahead of time, and may be created on the fly using `authProxyAutoSignUp`. Whenever a new user is detected (unable to match to existing user on either id or email), a user record will be added to SQLPad's user table and a user signed in. By default users are not auto-created and must otherwise be added ahead of time.
+SQLPad users do not need to be added ahead of time, and may be created on the fly using `SQLPAD_AUTH_PROXY_AUTO_SIGN_UP`. Whenever a new user is detected (unable to match to existing user on either id or email), a user record will be added to SQLPad's user table and a user signed in. By default users are not auto-created and must otherwise be added ahead of time.
 
 In addition to specifying core SQLPad user fields, custom user data fields may be populated using the field mapping `data.<customFieldName>`. This allows storing custom values to a specific user that may be referenced dynamically in connection configuration using mustache template syntax `{{user.data.<customFieldName>}}`. For example, you may map a user's a database username to `data.dbuser:X-WEBAUTH-DBUSER`, then later reference that value dynamically in a connection configuration by setting username to `{{user.data.dbuser}}`.
 
@@ -42,22 +40,22 @@ User fields available to map are:
 
 - `id` - used to identify users (optional - random value generated for SQLPad user.\_id if not provided)
 - `email` - natural identifier for users (required)
-- `role` - role for user (optional if `authProxyDefaultRole` defined, otherwise required mapping)
+- `role` - role for user (optional if `SQLPAD_AUTH_PROXY_DEFAULT_ROLE` defined, otherwise required mapping)
 - `name` - name for user (optional)
 - `data.<customFieldName>` - custom data field(s) for dynamic connection configuration (optional)
 
-Auth proxy settings in INI format are as follows:
-
-```ini
-; Enable auth proxy authentication
-authProxyEnabled = true
-; Auto create user record if it does not exist
-authProxyAutoSignUp = true
-; default role to use if not provided by header
-authProxyDefaultRole = editor
-; header mappings space-delimited.
-; convention is <user-field-to-map-to>:<header-name-to-use-for-value>
-authProxyHeaders = "id:X-WEBAUTH-ID email:X-WEBAUTH-EMAIL name:X-WEBAUTH-NAME role:X-WEBAUTH-ROLE data.customField:X-WEBAUTH-CUSTOM-FIELD"
+Auth proxy settings are as follows:
+
+```sh
+# Enable auth proxy authentication
+SQLPAD_AUTH_PROXY_ENABLED = true
+# Auto create user record if it does not exist
+SQLPAD_AUTH_PROXY_AUTO_SIGN_UP = true
+# default role to use if not provided by header
+SQLPAD_AUTH_PROXY_DEFAULT_ROLE = editor
+# header mappings space-delimited.
+# convention is <user-field-to-map-to>:<header-name-to-use-for-value>
+SQLPAD_AUTH_PROXY_HEADERS = "id:X-WEBAUTH-ID email:X-WEBAUTH-EMAIL name:X-WEBAUTH-NAME role:X-WEBAUTH-ROLE data.customField:X-WEBAUTH-CUSTOM-FIELD"
 ```
 
 ## Google OAuth
@@ -94,7 +92,7 @@ SAML-based authentication can be enabled by setting the necessary environment va
 - `PUBLIC_URL`
 - `DISABLE_USERPASS_AUTH`=`true` (optional - disables plain local user logins)
 
-SQLPad users do not need to be added ahead of time, and may be created on the fly using `samlAutoSignUp`. Whenever a new user is detected (unable to match to existing user email), a user record will be added to SQLPad's user table and a user signed in. By default users are not auto-created and must otherwise be added ahead of time.
+SQLPad users do not need to be added ahead of time, and may be created on the fly using `SQLPAD_SAML_AUTO_SIGN_UP`. Whenever a new user is detected (unable to match to existing user email), a user record will be added to SQLPad's user table and a user signed in. By default users are not auto-created and must otherwise be added ahead of time.
 
 ## LDAP (Experimental)
 
diff --git a/docs/configuration.md b/docs/configuration.md
index 950228f7..63fdf40e 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -1,21 +1,19 @@
 # Configuration
 
-SQLPad may be configured via environment variables, config file, or command line flags.
+SQLPad may be configured via environment variables or an .env config file.
 
 Config file path may be specified passing command line option `--config` or environment variable `SQLPAD_CONFIG`.
 For example:
 
 ```sh
-node server.js --config ~/sqlpad.ini
+node server.js --config path/to/.env
+# or
+env SQLPAD_CONFIG=path/to/.env node server.js
 ```
 
-Config file examples available in GitHub repository:
+A [config file example](https://github.com/rickbergfalk/sqlpad/blob/master/config-example.env) can be found in the GitHub repository.
 
-- [config-example.env](https://github.com/rickbergfalk/sqlpad/blob/master/config-example.env)
-- [config-example.ini](https://github.com/rickbergfalk/sqlpad/blob/master/config-example.ini)
-- [config-example.json](https://github.com/rickbergfalk/sqlpad/blob/master/config-example.json)
-
-?> For examples below, **key** refers to key in INI/JSON file. **Env** for environment variable.
+As of v5.1.0, INI and JSON configuration files are deprecated.
 
 ## admin
 
diff --git a/docs/connections.md b/docs/connections.md
index ef02d2de..7bc075ba 100644
--- a/docs/connections.md
+++ b/docs/connections.md
@@ -43,70 +43,11 @@ SQLPAD_CONNECTIONS__prod123__host=localhost
 SQLPAD_CONNECTIONS__prod123__mysqlInsecureAuth=true
 ```
 
-### Via INI Config File
-
-Connections may be defined in the `INI` configuration file used to provide application configuration. This file is referenced by either providing the `--config = path/to/file.ini` flag when running the application, or setting environment variable `SQLPAD_CONFIG=path/to/file.ini`. See [configuration](https://rickbergfalk.github.io/sqlpad/#/configuration?id=configuration) for more information.
-
-When defining a connection in an INI file, use section header with the value `connections.<connectionId>`.
-
-Every connection defined should provide a `name` and `driver` value, with driver equaling the value specified in the `driver` rows below. `name` will be the label used in the UI to label the connection.
-
-Field names and values are case sensitive.
-
-The connection ID value used can be any alphanumeric value, and is case-sensitive. This can be a randomly generated value like SQLPad's underlying embedded database uses, or it can be a more human-friendly name, or an id used from another source.
-
-Example INI config file with connection:
-
-```ini
-; The config file will have all your usual config
-admin = admin@sqlpad.com
-adminPassword = secret
-otherConfigKey = otherConfigValue
-
-; Plus additional sections for connections defined
-; Refer to tables below for specific keys that need populating for your database in use
-[connections.prod123]
-name = Production 123
-driver = mysql
-host = localhost
-mysqlInsecureAuth = true
-```
-
-### Via JSON Config File
-
-Connections may be defined in the `JSON` configuration file used to provide application configuration. This file is referenced by either providing the `--config = path/to/file.json` flag when running the application, or setting environment variable `SQLPAD_CONFIG=path/to/file.json`. See [configuration](https://rickbergfalk.github.io/sqlpad/#/configuration?id=configuration) for more information.
-
-When using JSON file, provide `<connectionId>` as a key under `connections`.
-
-Every connection defined should provide a `name` and `driver` value, with driver equaling the value specified in the `driver` rows below. `name` will be the label used in the UI to label the connection.
-
-Field names and values are case sensitive.
-
-The connection ID value used can be any alphanumeric value, and is case-sensitive. This can be a randomly generated value like SQLPad's underlying embedded database uses, or it can be a more human-friendly name, or an id used from another source.
-
-Example JSON config file with connection:
-
-```json
-{
-  "admin": "admin@sqlpad.com",
-  "adminPassword": "secret",
-  "otherConfigKey": "otherConfigValue",
-  "connections": {
-    "prod123": {
-      "name": "Production 123",
-      "driver": "mysql",
-      "host": "localhost",
-      "mysqlInsecureAuth": true
-    }
-  }
-}
-```
-
 ## Connection selection
 
 ?> Available as of `4.5.0`
 
-A default connection selection can be set using the `defaultConnectionId` configuration item or `SQLPAD_DEFAULT_CONNECTION_ID`. It can also be specified as part of the query editor URL, i.e., `https://mysqlpad.example.com/queries/new?connectionName=connection1` or `https://mysqlpad.example.com/queries/new?connectionId=xxx-xxxxx-xxx-xxx`.
+A default connection selection can be set using environment variable `SQLPAD_DEFAULT_CONNECTION_ID`. It can also be specified as part of the query editor URL, i.e., `https://mysqlpad.example.com/queries/new?connectionName=connection1` or `https://mysqlpad.example.com/queries/new?connectionId=xxx-xxxxx-xxx-xxx`.
 
 ## CrateDB
 
diff --git a/docs/getting-started.md b/docs/getting-started.md
index 266d20fb..e8b0c9b5 100644
--- a/docs/getting-started.md
+++ b/docs/getting-started.md
@@ -27,7 +27,7 @@ To update SQLPad:
 
 SQLPad runs its own migrations at application start, ensuring the schema is up-to-date.
 
-Prior to updating, it is recommended to take a backup of SQLPad's database files. These are located under the path specified by configuration variable `dbPath` or environment variable `SQLPAD_DB_PATH`. In the past these files used to default to the users home directory under `~/sqlpad/db`. In the official docker image, this path is set to `/var/lib/sqlpad`.
+Prior to updating, it is recommended to take a backup of SQLPad's database files. These are located under the path specified by environment variable `SQLPAD_DB_PATH`. In the past these files used to default to the users home directory under `~/sqlpad/db`. In the official docker image, this path is set to `/var/lib/sqlpad`.
 
 ## Database Migrations
 
diff --git a/docs/logging.md b/docs/logging.md
index 8f2043d3..647f3504 100644
--- a/docs/logging.md
+++ b/docs/logging.md
@@ -2,7 +2,7 @@
 
 SQLPad logs json messages using [pino](https://github.com/pinojs/pino), a simple and fast logging library. Log messages are sent to stdout, leaving how to handle the messages up to you. The pino ecosystem supports a variety of transports http://getpino.io/#/docs/transports that should cover most logging setups.
 
-Two categories of messages are logged by SQLPad: "app" messages containing info messages, warnings, and errors relating to application code, and "web" messages relating to the actual http requests handled by SQLPad. The level at which these logs are logged can be configured separately, or even turned off, with the `appLogLevel` and `webLogLevel` settings. This level represents the minimum level to be logged. The value used should be one of `fatal`, `error`, `warn`, `info`, `debug`, `trace` or `silent`. Setting the level to `silent` will effectively disable the logger.
+Two categories of messages are logged by SQLPad: "app" messages containing info messages, warnings, and errors relating to application code, and "web" messages relating to the actual http requests handled by SQLPad. The level at which these logs are logged can be configured separately, or even turned off, with the `SQLPAD_APP_LOG_LEVEL` and `SQLPAD_WEB_LOG_LEVEL` settings. This level represents the minimum level to be logged. The value used should be one of `fatal`, `error`, `warn`, `info`, `debug`, `trace` or `silent`. Setting the level to `silent` will effectively disable the logger.
 
 In production, log messages will be a single json object per line:
 
diff --git a/server/lib/config/index.js b/server/lib/config/index.js
index c5bcf1fa..166d1c17 100644
--- a/server/lib/config/index.js
+++ b/server/lib/config/index.js
@@ -70,6 +70,14 @@ class Config {
       errors.push(getOldConfigWarning());
     }
 
+    // If fileConfig has something in it, an INI or JSON file was read
+    // These file formats are deprecated, replaced by .env file and env vars
+    if (this.configFilePath && Object.keys(this.fileConfig).length > 0) {
+      warnings.push(
+        `DEPRECATED CONFIG: .json and .ini file support deprecated. Use .env file or environment variables instead.`
+      );
+    }
+
     // Check for any old environment variables in env.
     // This must be handled separately from other unknown checks,
     // as fromEnv() only gets config it knows about, so it will never have unknown values


Test patch:
diff --git a/server/test/lib/config.js b/server/test/lib/config.js
index 9dd9d507..f58eab39 100644
--- a/server/test/lib/config.js
+++ b/server/test/lib/config.js
@@ -83,6 +83,21 @@ describe('lib/config/fromFile', function () {
     assert(found, 'has error about old key');
   });
 
+  it('Deprecated warning for json/ini config file', function () {
+    const config = new Config(
+      { config: path.join(__dirname, '../fixtures/old-config.json') },
+      {}
+    );
+    const validations = config.getValidations();
+    assert(validations.warnings);
+    const found = validations.warnings.find(
+      (s) =>
+        s ===
+        'DEPRECATED CONFIG: .json and .ini file support deprecated. Use .env file or environment variables instead.'
+    );
+    assert(found, 'has warning about file deprecated');
+  });
+
   it('Errors for old cli flag', function () {
     const config = new Config({ debug: true }, {});
     const validations = config.getValidations();