Query password when executing SQL queries against Oracle databases

I don't like to store my passwords in plain in my files.  Next step should be to
cache the password, but maybe this is already achieved by using a dedicated
session?
This commit is contained in:
Daniel - 2020-06-15 19:56:30 +02:00
parent 0c61bf999d
commit 7daf582df5
No known key found for this signature in database
GPG Key ID: 1C7071A75BB72D64
1 changed files with 22 additions and 0 deletions

22
init.el
View File

@ -1215,6 +1215,28 @@ in the main agenda view."
:config (setf (alist-get :results org-babel-default-header-args)
"output code replace"))
(use-package ob-sql
:defer t
:config (progn
(defun db/ob-sql-oracle-ask-for-password (orig-fun
host port user password database)
"Ask for PASSWORD if not given, and call ORIG-FUN with arguments afterwards."
(cond
((not (or (and user database host port)
(and user database)))
(user-error "Insufficient login credentials given, aborting."))
(password
(funcall orig-fun host port user password database))
(t
(funcall orig-fun
host port user
(password-read (format "Password for %s@%s: " user database))
database))))
(advice-add #'org-babel-sql-dbstring-oracle
:around #'db/ob-sql-oracle-ask-for-password)))
;; Exporting
(use-package ox-icalendar