Send and receive SMS messages using your Android phone programmatically via a simple HTTP API
add cors config
orpheusohms48f27df93e0c
diff --git a/api/pkg/di/container.go b/api/pkg/di/container.goindex 6b54f63b..88c0adb8 100644--- a/api/pkg/di/container.go+++ b/api/pkg/di/container.go@@ -153,6 +153,15 @@ func NewContainer(projectID string, version string) (container *Container) {return container}+func GetEnvWithDefault(key, defaultValue string) string {+ value := os.Getenv(key)+ if value == "" {+ return defaultValue+ }++ return value+}+// App creates a new instance of fiber.Appfunc (container *Container) App() (app *fiber.App) {if container.app != nil {@@ -168,7 +177,15 @@ func (container *Container) App() (app *fiber.App) {}app.Use(otelfiber.Middleware())- app.Use(cors.New())+ app.Use(cors.New(+ cors.Config{+ AllowOrigins: GetEnvWithDefault("CORS_ALLOW_ORIGINS", "*"),+ AllowHeaders: GetEnvWithDefault("CORS_ALLOW_HEADERS", "*"),+ AllowMethods: GetEnvWithDefault("CORS_ALLOW_METHODS", "GET,POST,PUT,DELETE,OPTIONS"),+ AllowCredentials: false,+ ExposeHeaders: GetEnvWithDefault("CORS_EXPOSE_HEADERS", "*"),+ }))+app.Use(middlewares.HTTPRequestLogger(container.Tracer(), container.Logger()))app.Use(middlewares.BearerAuth(container.Logger(), container.Tracer(), container.FirebaseAuthClient()))diff --git a/docker-compose-cloud.yml b/docker-compose-cloud.ymldeleted file mode 100644index f1af12df..00000000--- a/docker-compose-cloud.yml+++ /dev/null@@ -1,67 +0,0 @@-version: "3.8"--services:- postgres:- image: postgres:alpine- environment:- POSTGRES_DB: httpsms- POSTGRES_PASSWORD: dbpassword- POSTGRES_USER: dbusername- volumes:- - postgres:/var/lib/postgresql/data- ports:- - "5435:5432"- restart: on-failure- healthcheck:- test: ["CMD-SHELL", "pg_isready", "-U", "dbusername", "-d", "httpsms"]- interval: 30s- timeout: 60s- retries: 5- start_period: 5s- networks:- - http-sms-network-- redis:- image: redis:latest- command: redis-server- volumes:- - redis:/var/lib/redis- ports:- - "6379:6379"- restart: on-failure- networks:- - http-sms-network-- api:- build:- context: ./api- ports:- - "8001:8000"- depends_on:- postgres:- condition: service_healthy- redis:- condition: service_started- env_file:- - ./api/.env- networks:- - http-sms-network-- web:- build:- context: ./web- ports:- - "3001:3000"- depends_on:- api:- condition: service_started- networks:- - http-sms-network--volumes:- redis:- postgres:--networks:- http-sms-network:- external: true