You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,7 @@
2
2
3
3
## 0.9.0.0
4
4
5
+
- Add @filename semantics to PGWS_DB_URI configiration variable to allow secret management to use a file instead of an environment variable.
5
6
- Add PGWS_RETRIES to limit the amount of times the server tries to open a database connection upon startup (defaults to 5). This breaks backward compatibility if you rely on the behaviour of the server to try infitite times.
After running the above command, open your browser on http://localhost:3000 to see an example of usage.
54
54
55
-
The sample config file provided in the [sample.conf](https://github.com/diogob/postgres-websockets/tree/master/sample.conf) file comes with a jwt secret just for testing and is used in the sample client.
55
+
The sample config file provided in the [sample-env](https://github.com/diogob/postgres-websockets/tree/master/sample-env) file comes with a jwt secret just for testing and is used in the sample client.
56
+
Note that the `sample-env` points to `./database-uri.txt` to load the URI from an external file. This is determined by the use of `@` as a prefix to the value of the variable `PGWS_DB_URI`.
57
+
This is entirely optional and the URI could be exported directly as `PGWS_DB_URI` without using the prefix `@`.
56
58
You will find the complete sources for the example under the folder [client-example](https://github.com/diogob/postgres-websockets/tree/master/client-example).
57
59
To run the server without giving access to any static files one can unser the variable `PGWS_ROOT_PATH`.
--| Given a shutdown handler and an AppConfig builds a Warp Settings to start a stand-alone server
49
49
warpSettings:: (IO()->IO()) ->AppConfig->Settings
@@ -73,6 +73,14 @@ readOptions =
73
73
<*> var auto "PGWS_POOL_SIZE" (def 10<> helpDef show<> help "How many connection to the database should be used by the connection pool")
74
74
<*> var auto "PGWS_RETRIES" (def 5<> helpDef show<> help "How many times it should try to connect to the database on startup before exiting with an error")
75
75
76
+
loadDatabaseURIFile::AppConfig->IOAppConfig
77
+
loadDatabaseURIFile conf@AppConfig{..} =
78
+
case stripPrefix "@" configDatabase of
79
+
Nothing->pure conf
80
+
Just filename -> setDatabase . strip <$>readFile (toS filename)
0 commit comments