made config file

This commit is contained in:
caschick221 2024-05-06 14:04:37 -04:00
parent bd824583ed
commit 197a1d44b4
2 changed files with 21 additions and 5 deletions

7
config.txt Normal file
View File

@ -0,0 +1,7 @@
[config]
dbhost = postgres.eggtech.net
dbname = CNSA-276-FP-DAS
dbusername = FP-DEV-USER
dbpassword = purchase-immortal-prescribe-repave-detention-seizing-candied-antiques-episode-list
doorID = 0

19
main.py
View File

@ -32,6 +32,7 @@ This works with both FIDO 2.0 devices as well as with U2F devices.
On Windows, the native WebAuthn API will be used. On Windows, the native WebAuthn API will be used.
""" """
import time import time
import configparser
import RPi.GPIO as GPIO import RPi.GPIO as GPIO
import pickle import pickle
import psycopg2 import psycopg2
@ -44,7 +45,15 @@ import sys
import ctypes import ctypes
from fido2.ctap2 import Ctap2 from fido2.ctap2 import Ctap2
DOOR_ID = 0 config = configparser.ConfigParser()
config.read('config.txt')
dbusername = config.get('config', 'dbusername')
dbpassword = config.get('config', 'dbpassword')
dbname = config.get('config', 'dbname')
dbhost = config.get('config', 'dbhost')
doorID = config.get('config', 'doorID')
gotAaguid = None gotAaguid = None
GPIO.setmode(GPIO.BCM) GPIO.setmode(GPIO.BCM)
@ -113,10 +122,10 @@ while True:
# Replace these variables with your connection parameters # Replace these variables with your connection parameters
dbname = "CNSA-276-FP-DAS"
user = "FP-DEV-USER" user = dbusername
password = "purchase-immortal-prescribe-repave-detention-seizing-candied-antiques-episode-list" password = dbpassword
host = "postgres.eggtech.net" host = dbhost
# Define the SQL query for retrieving data # Define the SQL query for retrieving data
select_query = ''' select_query = '''