[filescanner] use configparser

This commit is contained in:
Nico Schottelius 2019-12-08 13:51:40 +01:00
parent b235f0833c
commit 00563c7dc2
2 changed files with 14 additions and 6 deletions

View file

@ -41,8 +41,17 @@ USER_PREFIX = users
VM_PREFIX = vms
[storage]
STORAGE_BACKEND = #values = filesystem,
#values = filesystem, ceph
STORAGE_BACKEND =
# if STORAGE_BACKEND = filesystem
VM_DIR =
IMG_DIR =
# if STORAGE_BACKEND = ceph
CEPH_VM_POOL =
CEPH_IMG_POOL =
# Importing uploaded files
FILE_DIR = /var/lib/ucloud/files
FILE_PREFIX = noclue-ahmed

View file

@ -6,7 +6,7 @@ import time
from uuid import uuid4
from . import logger
from ucloud.config import env_vars, etcd_client
from ucloud.config import config, etcd_client
def getxattr(file, attr):
@ -69,9 +69,8 @@ except Exception as e:
def main():
BASE_DIR = env_vars.get("BASE_DIR")
FILE_PREFIX = env_vars.get("FILE_PREFIX")
BASE_DIR = config['storage']["FILE_DIR"]
FILE_PREFIX = config['storage']["FILE_PREFIX"]
# Recursively Get All Files and Folder below BASE_DIR
files = glob.glob("{}/**".format(BASE_DIR), recursive=True)