- Client-server authentication is out of scope. If needed, it can be implemented with mutual TLS (mTLS), or in a microservices design, an authentication/authorization reverse proxy in front of the server API.
- The server should handle messages sent by multiple clients simultaneously, so there is no guarantee that a client's message will not be overwritten by another client sending a message for the same filename.
- Write throughput and performance is more important than a client receiving synchronous confirmation of a successful write.
The server exposes a REST API POST endpoint at /api/v1/file/name where name
is the name of the properties file without the .properties
extension. Only alphanumeric characters, _
, and -
are supported. Supported filename characters were designed to be a non-configurable allowlist, to avoid misconfigurations that can introduce security issues, such as allowing the character .
, which can result in writing to a parent directory with ..
in Linux/Unix.
- 202 Accepted: The request has been accepted for processing.
- 400 Bad Request: The request is invalid.
- 500 Internal Server Error: An unexpected server error occurred.
- Install JDK 17+ and
mvn
(Maven). - Create server.properties file:
server.port=8888
logging.level.io.github.anomal.propsserver=DEBUG
outputdir=/var/tmp/serveroutput
- Go to repository root.
- Run:
mvn spring-boot:run -Dspring-boot.run.arguments=--spring.config.location=file:///path/to/server.properties
This was tested on Linux.
curl -v -H "Content-Type: application/json" -d '{ "http" : "80", "https" : "443" }' localhost:8888/api/v1/file/name