0

I have an issue not reading properties from a file as a file system backend.

I tried to use these lines shown below to reach the file but it didn't work.

Here is my APIConfig.properties file shown below beneath file-system-backend-config

token.expiration_time = 8640000
token.secret = hfgry463hf746hf573ydh475fhy57414141
login.url.path = /users/login

Here is my application.properties under PhotoAppAPIConfigServer

server.port=8042
# File System Backend
spring.profiles.active= native
spring.cloud.config.server.native.search-locations= file:///C:/Users/Noyan/Desktop/dev/file-system-backend-config

# Bus Refresh
management.endpoints.web.exposure.include=busrefresh

# Rabbit MQ
spring.rabbitmq.host=localhost
spring.rabbitmq.port=5672
spring.rabbitmq.username=guest
spring.rabbitmq.password=guest

I got an issue when I run this config server. Here is my error message shown below.

java.lang.IllegalArgumentException: Pattern cannot be null or empty

How can I fix it?

S.N
  • 2,157
  • 3
  • 29
  • 78

1 Answers1

1

To use a file system backend, just write into application.properties file:

server.port=8042
spring.application.name=photo-app-config # Not mandatory 
spring.profiles.active=native
spring.cloud.config.server.native.search-locations=classpath:/config
# spring.cloud.config.server.native.search-locations=file:///C:/config # Or your preferred absolute path

Put your configurations into:

  • classpath:/config:(project directory)

     resources/config/api-config.properties
    
  • file:///C:/config:(your system directory)

     C:/config/api-config.properties
    

Now read your configurations through the URL:

http://localhost:8042/api-config/default

100% tested.

Subarata Talukder
  • 5,407
  • 2
  • 34
  • 50