From b5c40f2e130551637d97a0416872c6c46c7eba2a Mon Sep 17 00:00:00 2001 From: songtianlun Date: Wed, 22 Jan 2025 17:07:04 +0800 Subject: [PATCH] fix: update Dockerfile and weather service configuration - Added 'libpq-dev' to the packages installed in the Dockerfile - Updated the base_uri in WeatherService to use 'dig' for safer access These changes improve the Docker environment by ensuring that necessary PostgreSQL development headers are available during installation. The weather service now safely accesses the URI from the credentials, reducing the risk of errors when fetching nested configuration data. --- Dockerfile | 2 +- app/services/weather_service.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 73d9e6f..eab28b8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,7 +30,7 @@ FROM base AS build # Install packages needed to build gems and node modules RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y build-essential git node-gyp pkg-config python-is-python3 && \ + apt-get install --no-install-recommends -y build-essential git node-gyp pkg-config python-is-python3 libpq-dev && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Install JavaScript dependencies diff --git a/app/services/weather_service.rb b/app/services/weather_service.rb index 679d682..da1e340 100644 --- a/app/services/weather_service.rb +++ b/app/services/weather_service.rb @@ -1,7 +1,7 @@ # app/services/weather_service.rb class WeatherService include HTTParty - base_uri Rails.application.credentials.qweather.uri + base_uri Rails.application.credentials.dig(:qweather, :uri) def initialize @api_key = Rails.application.credentials.qweather.token