ajustes url y loggin
This commit is contained in:
@ -8,7 +8,7 @@ WORKDIR /app
|
|||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Construir el JAR con Gradle
|
# Construir el JAR con Gradle
|
||||||
RUN ./gradlew build
|
RUN ./gradlew build -x test
|
||||||
|
|
||||||
# Imagen final con solo el JAR
|
# Imagen final con solo el JAR
|
||||||
FROM eclipse-temurin:17-jdk
|
FROM eclipse-temurin:17-jdk
|
||||||
|
@ -8,6 +8,9 @@ import java.net.URLEncoder;
|
|||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import es.imunnic.inversionitasBot.TelegramBot;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
@ -15,8 +18,10 @@ import org.springframework.stereotype.Component;
|
|||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class ApiService {
|
public class ApiService {
|
||||||
@Value("${apiservice.url}")
|
//@Value("${apiservice.url}")
|
||||||
private static String API_BASE_URL;
|
private static String API_BASE_URL="http://fastapi_app:8000/news";
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(TelegramBot.class);
|
||||||
|
|
||||||
// Método genérico para hacer solicitudes GET
|
// Método genérico para hacer solicitudes GET
|
||||||
public static String sendGetRequest(String endpoint) {
|
public static String sendGetRequest(String endpoint) {
|
||||||
@ -33,7 +38,7 @@ public class ApiService {
|
|||||||
}
|
}
|
||||||
in.close();
|
in.close();
|
||||||
connection.disconnect();
|
connection.disconnect();
|
||||||
|
logger.info("Mensaje recibido: {}", content.toString());
|
||||||
return content.toString();
|
return content.toString();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return "{\"error\": \"Error al obtener datos de la API\"}";
|
return "{\"error\": \"Error al obtener datos de la API\"}";
|
||||||
|
Reference in New Issue
Block a user