cc: rename data_dir parameter in encryptor to password_file_dir
This commit is contained in:
parent
115368f83d
commit
fdeec3a634
|
@ -15,9 +15,9 @@ class Encryptor:
|
||||||
_BLOCK_SIZE = 32
|
_BLOCK_SIZE = 32
|
||||||
_PASSWORD_FILENAME = "mongo_key.bin"
|
_PASSWORD_FILENAME = "mongo_key.bin"
|
||||||
|
|
||||||
def __init__(self, data_dir):
|
def __init__(self, password_file_dir):
|
||||||
password_file = os.path.expanduser(
|
password_file = os.path.expanduser(
|
||||||
os.path.join(data_dir, self._PASSWORD_FILENAME)
|
os.path.join(password_file_dir, self._PASSWORD_FILENAME)
|
||||||
)
|
)
|
||||||
|
|
||||||
if os.path.exists(password_file):
|
if os.path.exists(password_file):
|
||||||
|
@ -56,10 +56,10 @@ class Encryptor:
|
||||||
return self._unpad(cipher.decrypt(enc_message[AES.block_size :]).decode())
|
return self._unpad(cipher.decrypt(enc_message[AES.block_size :]).decode())
|
||||||
|
|
||||||
|
|
||||||
def initialize_encryptor(data_dir):
|
def initialize_encryptor(password_file_dir):
|
||||||
global _encryptor
|
global _encryptor
|
||||||
|
|
||||||
_encryptor = Encryptor(data_dir)
|
_encryptor = Encryptor(password_file_dir)
|
||||||
|
|
||||||
|
|
||||||
def get_encryptor():
|
def get_encryptor():
|
||||||
|
|
Loading…
Reference in New Issue