Where exactly do we place this postgresql.conf configuration file in spring boot application?

最后都变了- 提交于 2020-08-10 13:10:50

问题


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

My enity code is below,

@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 configuration file: encrypt.key = 'Wow! So much security.

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?


回答1:


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.

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.



来源:https://stackoverflow.com/questions/63245496/where-exactly-do-we-place-this-postgresql-conf-configuration-file-in-spring-boot

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!