#10 Ticket 2 - allow configuration of the portal
Merged by firstyear. Opened by firstyear.
firstyear/389-ds-portal 2-configuration  into  master

Bug Description: Many sites will want to allow customising
their portal experience by changing what attributes "can" and
"can not" be edited, what is displayed, and of course the
basedn of the site.

Fix Description: Allow limited configuration of the instance
via a config.ini file.

https://pagure.io/389-ds-portal/issue/2

Author: William Brown william@blackhats.net.au

Review by: ???

Sorry I still can not get devel.sh to work with python3. Complains about flask, but I already have python3-flask installed.

$ ./devel.sh 
./devel.sh: line 2: flask: command not found

If I install python2-flask it starts (not sure how well it works), but this needs to really be working with python3 especially in RHEL 8.

Okay if I run devel.sh in a python venv it works as expected. I'll try and get this all reviewed asap!

Running with this patch I get an error when loading the page:

127.0.0.1 - - [29/Oct/2019 09:51:09] "GET / HTTP/1.1" 500 -
Traceback (most recent call last):
  File "/home/mareynol/source/389-ds-portal/server.py", line 23, in <module>
    app.secret_key = base64.b64decode(config['DEFAULT']['cookie_signing_key'])
  File "/usr/lib64/python3.7/configparser.py", line 1251, in __getitem__
    raise KeyError(key)
KeyError: 'cookie_signing_key'

Did you setup a configuration :)

Anyway, I probably should make the error handling "communicate better" in this case.

1 new commit added

  • Update example, and improve server to have better configuration errors

Okay, this makes the core errors clearer when you start the server:

> ./devel.sh
 * Serving Flask app "server" (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: on
 * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
 * Restarting with stat
[2019-11-04 12:54:42,840] ERROR in server: Missing config.ini option dsportal:basedn

@mreynolds Gentle review reminder?

rebased onto daeb15f2d2f88b8fc78a969dfcd8580eb89bc806

Pull-Request has been merged by firstyear