Skip to content

Service Configuration Overview

Each SMS Gateway service is a Spring Boot application. Its src/main/resources directory contains a main application.yml file and an application-dev.yml file for development.

This page explains settings shared by several services. See each service's configuration page for database, Redis, Kafka, JWT, admin API key, Jasypt, routing, campaign, and carrier settings.

Ways to set configuration

You can set configuration in several places:

Source Example When to use it
Main YAML file services/<service>/src/main/resources/application.yml Default settings used by every profile
Profile YAML file services/<service>/src/main/resources/application-dev.yml Development settings for ports, Eureka, logs, databases, Redis, Kafka, and other values
Environment variables SERVER_PORT=9015 Values set by a shell, Docker, Kubernetes, CI/CD, or a service manager
JVM system properties -Dserver.port=9015 Values passed directly to the JVM when the service starts
Command-line arguments --server.port=9015 Temporary values used when starting a service manually

When the same setting appears in more than one place, the value with higher priority is used. Command-line arguments, JVM system properties, and environment variables override the profile YAML file. The profile YAML file overrides the main application.yml file.

Spring Boot lets you write property names as environment variables by using uppercase letters and underscores. For example, use SERVER_PORT for server.port and SPRING_PROFILES_ACTIVE for spring.profiles.active.

Example:

export SPRING_PROFILES_ACTIVE=dev
export SERVER_PORT=9015

java -jar services/sms-router-service/target/service-jars/sms-router-service.jar

You can also set values directly in the startup command:

java -jar services/gateway-service/target/service-jars/gateway-service.jar \
  --spring.profiles.active=dev \
  --server.port=8000

Select a profile

All services use spring.profiles.active to select a Spring profile.

Property Environment Variable Purpose
spring.profiles.active SPRING_PROFILES_ACTIVE Selects the profile. For example, the dev profile loads application-dev.yml, which overrides values in application.yml.

Some services also use ${ACTIVE_PROFILE:dev} in their YAML files. Use SPRING_PROFILES_ACTIVE for a consistent setup unless a service's run script already uses ACTIVE_PROFILE.

Settings shared by services

Several services use these settings:

Property Environment Variable Purpose
spring.application.name SPRING_APPLICATION_NAME Service name used by Spring, logs, service discovery, and generated instance IDs
server.port SERVER_PORT HTTP port used by the service. Development files set fixed ports for several services. Some main files use 0, which lets the system choose an available port.
server.shutdown SERVER_SHUTDOWN Controls how the service stops. graceful waits for current requests to finish, while immediate stops at once. The main configuration uses graceful.
management.endpoints.web.exposure.include MANAGEMENT_ENDPOINTS_WEB_EXPOSURE_INCLUDE Selects the management endpoints available over HTTP. * enables all endpoints, while health,info enables only health and information endpoints.
management.endpoint.health.probes.enabled MANAGEMENT_ENDPOINT_HEALTH_PROBES_ENABLED Turns liveness and readiness health checks on or off. Use true to enable them or false to disable them.

Local development setup

For local development, most services use this setup:

  1. application.yml sets the service name, shutdown behavior, health endpoints, and other default values.
  2. application-dev.yml sets local ports and connections to Eureka, PostgreSQL, Redis, or Kafka when the service needs them.
  3. Environment variables provide secrets and values that change between environments. Do not save these values in YAML files tracked by Git.

Configuration for each service

Use these pages for settings that apply to only one service:

Service Configuration Page
gateway-service Gateway Service
client-service Client Service
sms-router-service SMS Router Service
aggregator-integration-service Aggregator Service
discovery-service Discovery Service