Holiday API is a Wrapper for Salling's holiday API, fetching Danish holiday data and extends it.
1.6K
The Holiday API is a data api wrapper for the Salling holiday API. It fetches holiday data from the Salling service and returns it to the client. The data includes both national and non-national holidays.
It can be set up automatically to pull data from the Salling Group API at a specified interval, or an external cron job can be used to call it.
To use internal scheduling, the CRON_ENABLED environment variable must be set to true and then
CRON_PULL_SALLING can be used to set the cron expression for pulling data.
Here a default of 0 0 4 * * * is set, which will default 12 months of holidays at 4 AM every day. Or you can set
custom
range for 10 years (5 years before and after today) by setting the HOLIDAY_URI_CUSTOM_RANGE environment variable to
https://api.sallinggroup.com/v1/holidays/?startDate=2011-01-02&endDate=2028-09-09 then this will be used instead of
the default 12 months.
The API documentation for the salling api can be found here, which provides further details on the Salling API terms and usage.
TODO—there will be an openapi included for each release for quick api scaffold against this small API service.
A postman collection can be found here
This project integrates with the Salling Group API. The data retrieved and processed by this project is subject
to Salling Group's terms and conditions.
As a user of this software, you are required to comply with those terms when using the Salling Group data.
Specifically:
The API wrapper can be run through docker. Follow the steps below to set it up:
docker pull jah118/holiday-api-wrapper
Run the Docker container:
docker run -d -p 8080:8080 -e HOLIDAY_API_TOKEN=Your_Api_key --name holidayapi-wrapper holidayapi-wrapper
Configuration (Optional):
.env file:
docker run -d -p 8080:8080 --env-file .env --name holidayapi-wrapper holidayapi-wrapper
Clone the repository:
git clone <repository-url>
cd <repository-folder>
Build the Docker image (if a custom build is required):
docker build -t holidayapi-wrapper .
Run the Docker container:
docker run -d -p <host-port>:8080 -e HOLIDAY_API_TOKEN=Your_Api_key --name holidayapi-wrapper holidayapi-wrapper
Configuration (Optional):
.env file:
docker run -d -p <host-port>:8080 --env-file .env --name api-wrapper-cache api-wrapper-cache
Access the API wrapper/Cache:
Use http://localhost:<host-port> to access the running service.
Replace <repository-url>, <repository-folder>, <host-port>, and <container-port> with appropriate values for
your setup.
To configure the application, you can use the following environment variables. These options allow flexibility and customization depending on your deployment environment. Default values are provided where applicable.
| Environment Variable | Default Value | Description |
|---|---|---|
| Server Configuration | ||
SERVER_PORT | 8080 | Port on which the application server runs. |
SERVER_COMPRESSION_ENABLED | false | Enables GZIP compression for HTTP responses. |
| Management Configuration | ||
MANAGEMENT_SERVER_PORT | 8080 | Port for management endpoints (health, metrics, etc.). |
MANAGEMENT_ENDPOINTS_INCLUDE | health,prometheus,openapi,readinessState,info,probes,metrics | Comma-separated list of management endpoints to expose. |
| Security Configuration | ||
SECURITY_STATE | false | Determines whether the security features of the service are enabled. |
APIKEY | NotSetUseDefault | Defines the API key for authentication; if not set, a default key will be used. |
| Data Source Configuration | ||
SPRING_DATASOURCE_URL | jdbc:h2:mem:holidayapi | JDBC URL for the data source. |
SPRING_DATASOURCE_USERNAME | sa | Username for the data source. |
SPRING_DATASOURCE_PASSWORD | password | Password for the data source. |
H2_CONSOLE_ENABLED | false | Enables H2 database console (disable in production). |
| JPA/Hibernate Configuration | ||
SPRING_JPA_HIBERNATE_DDL_AUTO | create-drop | Hibernate DDL auto mode (create, update, validate, etc.). |
SPRING_JPA_PROPERTIES_HIBERNATE_FORMAT_SQL | false | Formats SQL statements in logs for better readability. |
SPRING_JPA_SHOW_SQL | false | Shows SQL statements in logs. |
SPRING_JPA_OPEN_IN_VIEW | false | Enables Open Session in View pattern. |
| Holiday API Configuration | ||
HOLIDAY_API_TOKEN | - | Token used to access the external Holiday API (required). |
HOLIDAY_BASE_URI | https://api.sallinggroup.com/v1/holidays | Base URI for fetching holiday data from Salling Group API. |
HOLIDAY_URI_CUSTOM_RANGE | null | Custom URI for fetching holidays within a specific date range. |
HOLIDAY_ENABLE_CUSTOM_RANGE | false | Enables 10-year range (5 years before/after current date) when custom range not specified. |
HOLIDAY_URI_COUNTRY | dk | Country code for the Salling Group API (dk for Denmark). |
HOLIDAYAPI_SHOULD_RESET_EACH_TIME | false | Indicates if data should reset every time the application runs. |
HOLIDAYAPI_USE_MOCK_DATA | false | Uses mock data instead of calling external API (for testing). |
| Application Configuration | ||
APP_PULL_DATA_AT_STARTUP | false | Determines whether the application should pull data during startup. |
| Cron Job Configuration | ||
CRON_PULL_SALLING | 0 0 4 * * * | Cron expression for pulling data from Salling Group's Holiday API (daily at 4 AM). |
CRON_ENABLED | false | Toggles cron jobs on or off. |
| Swagger Configuration | ||
SWAGGER_DOC_ENABLED | true | Enables Swagger API documentation. |
SWAGGER_UI_PATH | /swagger-ui.html | The path where Swagger UI can be accessed. |
| Logging Configuration | ||
LOGGING_LEVEL_SPRING_FRAMEWORK | INFO | Logging level for Spring Framework. |
LOGGING_LEVEL_HOLIDAYAPI | INFO | Logging level for Holiday API-related logs. |
.env file or configured directly in the environment where
the application is running.SPRING_DATASOURCE_PASSWORD and HOLIDAY_API_TOKEN in a
secure manner.HOLIDAY_API_TOKEN is required for the application to function properly with the Salling Group API.SECURITY_STATE is enabled, ensure you set a secure APIKEY value instead of using the default.H2_CONSOLE_ENABLED=false) in production environments for security reasons.Content type
Image
Digest
sha256:14f33edda…
Size
112.8 MB
Last updated
3 months ago
docker pull jah118/holiday-api-wrapper