##// END OF EJS Templates
encryption: use common method to fetch encryption key for encrypted fields.
marcink -
r261:c66c7ec2 default
parent child Browse files
Show More
@@ -68,9 +68,9 b' def configure_vcs(config):'
68 68
69 69
70 70 def initialize_database(config):
71 from rhodecode.lib.utils2 import engine_from_config
71 from rhodecode.lib.utils2 import engine_from_config, get_encryption_key
72 72 engine = engine_from_config(config, 'sqlalchemy.db1.')
73 init_model(engine, encryption_key=config['beaker.session.secret'])
73 init_model(engine, encryption_key=get_encryption_key(config))
74 74
75 75
76 76 def initialize_test_environment(settings, test_env=None):
@@ -342,6 +342,10 b' def engine_from_config(configuration, pr'
342 342 return engine
343 343
344 344
345 def get_encryption_key(config):
346 return config['beaker.session.secret']
347
348
345 349 def age(prevdate, now=None, show_short_version=False, show_suffix=True,
346 350 short_format=False):
347 351 """
@@ -46,7 +46,7 b' from pylons import config'
46 46 from pyramid.threadlocal import get_current_registry
47 47
48 48 from rhodecode.model import meta, db
49 from rhodecode.lib.utils2 import obfuscate_url_pw
49 from rhodecode.lib.utils2 import obfuscate_url_pw, get_encryption_key
50 50
51 51 log = logging.getLogger(__name__)
52 52
@@ -66,8 +66,8 b' def init_model(engine, encryption_key=No'
66 66
67 67
68 68 def init_model_encryption(migration_models):
69 migration_models.ENCRYPTION_KEY = config['beaker.session.secret']
70 db.ENCRYPTION_KEY = config['beaker.session.secret']
69 migration_models.ENCRYPTION_KEY = get_encryption_key(config)
70 db.ENCRYPTION_KEY = get_encryption_key(config)
71 71
72 72
73 73 class BaseModel(object):
General Comments 0
You need to be logged in to leave comments. Login now