我们将这个postgresql.conf配置文件放在Spring Boot应用程序中的确切位置? [英] Where exactly do we place this postgresql.conf configuration file in spring boot application?

查看:121
本文介绍了我们将这个postgresql.conf配置文件放在Spring Boot应用程序中的确切位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试对prostrgres DB中的列进行加密.列名是"test".类型为"bytea".

I am trying to encrypt a column in my prostrgres DB. The column name is "test" of type "bytea".

我的实体代码在下面,

@ColumnTransformer(read = "pgp_sym_decrypt(" + "    test, "
        + "    current_setting('encrypt.key')"
        + ")", write = "pgp_sym_encrypt( " + "    ?, "
                + "    current_setting('encrypt.key')" + ") ")
@Column(columnDefinition = "bytea")
private String test;

postgresql.conf配置文件: crypto.key ='哇!非常安全.

postgresql.conf configuration file: encrypt.key = 'Wow! So much security.

将postgresql.conf配置文件放置在spring boot appln的src/main/resources中.但是没有选择encryption.key值.有没有一种方法可以使用application.properties传递密钥?

Placed the postgresql.conf configuration file in src/main/resources of spring boot appln. But the encryption.key value is not being picked up. And is there a way to pass the key using application.properties?

推荐答案

postgresql.conf数据目录(也称为集群")中服务器.

postgresql.conf is the configuration file for the Postgres server. It's stored inside the data directory (aka "cluster") on the server.

您不能将其放在客户端(您的应用程序运行所在的位置)上.那里没有意义.

You can't put it on the client side (where your application runs). It has no meaning there.

要在其中更改值,您需要编辑文件(在服务器上)或使用

To change values in there, you need to edit the file (on the server) or use ALTER SYSTEM.

如果要更改当前会话的配置设置,请使用 SET set_config()

If you want to change a configuration setting for the current session, use SET or set_config()

后两个可能是您要为加密/解密功能初始化自定义属性的对象.

The latter two are probably the ones you are looking for to initialize the custom property for your encryption/decryption functions.

这篇关于我们将这个postgresql.conf配置文件放在Spring Boot应用程序中的确切位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆