Improve backend selection system

Use a string instead of changing the import line

Related to #1
This commit is contained in:
Samuel Sloniker 2021-06-20 15:48:14 -07:00
parent d18cf3e674
commit 67136506a4

View File

@ -1,9 +1,8 @@
# Select backend - backends.port8080 uses HamClock's port 8080 service; # Select backend - 'port8080' uses HamClock's port 8080 service; 'x11' uses an
# backends.x11 uses an X11 server (typically Xvfb) (make sure DISPLAY is set # X11 server (typically Xvfb) (make sure DISPLAY is set correctly!)
# correctly!)
#import backends.port8080 as backend use_backend = 'x11'
import backends.x11 as backend # use_backend = 'port8080'
import os import os
@ -17,9 +16,10 @@ import tornado.web, tornado.websocket, tornado.ioloop
import imgproc as hcapi import imgproc as hcapi
import argon2 import argon2
import asyncio import asyncio
import importlib
hcapi.backend = backend hcapi.backend = importlib.import_module(f'backends.{use_backend}')
ph = argon2.PasswordHasher() ph = argon2.PasswordHasher()