-
Notifications
You must be signed in to change notification settings - Fork 0
/
configuration.py
27 lines (25 loc) · 986 Bytes
/
configuration.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#-*- coding: utf-8 -*-
#@author: [email protected]
import yaml
## Class to load the configuration from the yaml file
class configuration:
## Constructor
def __init__(self):
with open("conf.yaml",'r') as f:
doc = yaml.load(f)
## Username for the connection
self.username= doc["Database"]["User"]
## Database
self.database= doc["Database"]["Database"]
## Password
self.password= doc["Database"]["Password"]
## Type of database (mysql or postgres)
self.dbType= doc["Database"]["Type"]
## Host of the database
self.host= doc["Database"]["Host"]
## Max file size for upload
self.size = doc["File"]["Max"]
## Path for storing uploaded data
self.path = doc["File"]["Path"]
## Allowed file types for upload
self.types = doc["File"]["Types"].split(',')