如何在Flyway DB配置文件中指定多行属性值?

时间:2014-11-10 15:01:17

标签: flyway

我正在尝试将PGP加密密钥放入Flyway数据库配置文件中。像这样:

# Encryption key for encrypting stuff
flyway.placeholders.encryptionKey=-----BEGIN PGP PUBLIC KEY BLOCK-----  
Version: BCPG C# v1.2.3.4    

mQEGBFRgnDEBCACi4yRYnmLtgEBoXfx+YYwZ1b6xPRN5oZBqp76YGPwtVfNGOzpK
JKclFD1uIr/MIQZB89G2Z4gJB/q2E+CNbHUGc/bxU8DpGOOo3DsN2UP2xxz41sRY
7eW0SiSSIw2Cu+4dG3Ic+pBv8pxUFZDCyGCtENucfoxKe3J69IWNbBRCiftndW2A
Wf7vPyrygcD+9Ju/7OrLL7FnWJ66TZk6DUgjMm1c4J4ZoyHRfZHEvhx/j2OlxzIV
ysHXThyrVZzkO0sA0kobzJEfdpKhRg==
=SpNy
-----END PGP PUBLIC KEY BLOCK-----  

然后我在更新SQL脚本中使用该属性,例如

UPDATE [MyTable] SET [MyColumn] = '${encryptionKey}'

当我运行更新时,它只需使用密钥的第一行进行更新。有没有办法在Flyway配置文件中指定多行属性?

1 个答案:

答案 0 :(得分:2)

必须将\ n \添加到每行的末尾,如下所示:

# Encryption key for encrypting stuff
flyway.placeholders.encryptionKey=-----BEGIN PGP PUBLIC KEY BLOCK-----  \n\
Version: BCPG C# v1.2.3.4    \n\
\n\
mQEGBFRgnDEBCACi4yRYnmLtgEBoXfx+YYwZ1b6xPRN5oZBqp76YGPwtVfNGOzpK\n\
JKclFD1uIr/MIQZB89G2Z4gJB/q2E+CNbHUGc/bxU8DpGOOo3DsN2UP2xxz41sRY\n\
7eW0SiSSIw2Cu+4dG3Ic+pBv8pxUFZDCyGCtENucfoxKe3J69IWNbBRCiftndW2A\n\
Wf7vPyrygcD+9Ju/7OrLL7FnWJ66TZk6DUgjMm1c4J4ZoyHRfZHEvhx/j2OlxzIV\n\
ysHXThyrVZzkO0sA0kobzJEfdpKhRg==\n\
=SpNy\n\
-----END PGP PUBLIC KEY BLOCK-----