Changeset - 12fce5e499d5
[Not reviewed]
beta
0 2 0
Marcin Kuzminski - 13 years ago 2012-09-29 19:16:00
marcin@python-works.com
obfuscate password in logs for engine connection string
2 files changed with 11 insertions and 2 deletions:
0 comments (0 inline, 0 general)
rhodecode/lib/utils2.py
Show inline comments
 
@@ -497,3 +497,11 @@ def fix_PATH(os_=None):
 
    cur_path = os.path.split(sys.executable)[0]
 
    if not os.environ['PATH'].startswith(cur_path):
 
        os.environ['PATH'] = '%s:%s' % (cur_path, os.environ['PATH'])
 

	
 

	
 
def obfuscate_url_pw(engine):
 
    from sqlalchemy.engine import url
 
    url = url.make_url(engine)
 
    if url.password:
 
        url.password = 'XXXXX'
 
    return str(url)
 
\ No newline at end of file
rhodecode/model/__init__.py
Show inline comments
 
@@ -43,7 +43,7 @@
 

	
 
import logging
 
from rhodecode.model import meta
 
from rhodecode.lib.utils2 import safe_str
 
from rhodecode.lib.utils2 import safe_str, obfuscate_url_pw
 

	
 
log = logging.getLogger(__name__)
 

	
 
@@ -56,7 +56,8 @@ def init_model(engine):
 

	
 
    :param engine: engine to bind to
 
    """
 
    log.info("initializing db for %s" % engine)
 
    engine_str = obfuscate_url_pw(str(engine.url))
 
    log.info("initializing db for %s" % engine_str)
 
    meta.Base.metadata.bind = engine
 

	
 

	
0 comments (0 inline, 0 general)