Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Absolute path in application.yml

I am having some troubles in order to specify the absolute path of some resources in the application.yml of my spring boot app.

Using relative path works ok, I place those files under src/main/resources/key with the following configuration:

public:
  encryption:
    key: keys\encrypt\public_enc_asn1.key
  decryption:
    key: keys\decrypt\public_dec_asn1.key
private:
  decryption:
    key: keys\decrypt\private_dec_asn1.key

I am using windows. I put the same files under C:\test\ with the following configs in application.yml but they are not working:

public:
  encryption:
    key: C:\test\encrypt\public_enc_asn1.key
  decryption:
    key: C:\test\decrypt\public_dec_asn1.key
private:
  decryption:
    key: C:\test\decrypt\private_dec_asn1.key

How can I specify a windows absolute path in application.yml? I also tried with ${user.home} option but no luck.

like image 679
fsimon Avatar asked Jan 06 '23 12:01

fsimon


1 Answers

The error is due to colon in your values (as in C:\test\...). You need to surround your value with quotes:

public:
  encryption:
    key: 'C:\test\encrypt\public_enc_asn1.key'
  decryption:
    key: 'C:\test\decrypt\public_dec_asn1.key'
private:
  decryption:
    key: 'C:\test\decrypt\private_dec_asn1.key'
like image 125
alexbt Avatar answered Jan 13 '23 11:01

alexbt