feat(dadbod): read databases from the encrypted file
This commit is contained in:
@@ -1,20 +1,37 @@
|
|||||||
return {
|
return {
|
||||||
'kristijanhusak/vim-dadbod-ui',
|
'kristijanhusak/vim-dadbod-ui',
|
||||||
dependencies = {
|
dependencies = {
|
||||||
{ 'tpope/vim-dadbod', lazy = true },
|
{ 'tpope/vim-dadbod', lazy = true },
|
||||||
{ 'kristijanhusak/vim-dadbod-completion', ft = { 'sql', 'mysql', 'plsql' }, lazy = true }, -- Optional
|
{ 'kristijanhusak/vim-dadbod-completion', ft = { 'sql', 'mysql', 'plsql' }, lazy = true }, -- Optional
|
||||||
},
|
},
|
||||||
cmd = {
|
cmd = {
|
||||||
'DBUI',
|
'DBUI',
|
||||||
'DBUIToggle',
|
'DBUIToggle',
|
||||||
'DBUIAddConnection',
|
'DBUIAddConnection',
|
||||||
'DBUIFindBuffer',
|
'DBUIFindBuffer',
|
||||||
},
|
},
|
||||||
init = function()
|
init = function()
|
||||||
-- Your DBUI configuration
|
-- Your DBUI configuration
|
||||||
vim.g.db_ui_use_nerd_fonts = 1
|
vim.g.db_ui_use_nerd_fonts = 1
|
||||||
vim.g.db_ui_auto_execute_table_helpers = 1
|
vim.g.db_ui_auto_execute_table_helpers = 1
|
||||||
vim.g.db_ui_win_position = 'left'
|
vim.g.db_ui_win_position = 'left'
|
||||||
end,
|
|
||||||
|
local sops = require('crentist.sops')
|
||||||
|
local sops_runner = sops.create_runner({})
|
||||||
|
|
||||||
|
local decrypted_dbs = sops_runner:to_table('~/.dotfiles/dbs.yaml')
|
||||||
|
if decrypted_dbs then
|
||||||
|
vim.g.dbs = decrypted_dbs.databases
|
||||||
|
end
|
||||||
|
|
||||||
|
local refresh_db = function()
|
||||||
|
decrypted_dbs = sops_runner:to_table('~/.dotfiles/dbs.yaml')
|
||||||
|
if decrypted_dbs then
|
||||||
|
vim.g.dbs = decrypted_dbs.databases
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_create_user_command('DBRefresh', refresh_db, {})
|
||||||
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user