-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Dockerfile, Docker Compose, and Enhanced (Colored) Logging with Timezone Support for Wuzapi API #70
Open
guilhermejansen
wants to merge
19
commits into
asternic:main
Choose a base branch
from
guilhermejansen:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit updates the go.sum file to include new dependencies and their respective versions. Notable changes include the addition of several packages such as , , and updates to existing packages like and . These changes ensure that the project is using the latest compatible versions of its dependencies.
…k management functions This commit modifies existing database queries in the file to use PostgreSQL's parameterized query syntax (using , , etc.) instead of the previous syntax. Additionally, it introduces new functions for managing webhooks, including , , and , enhancing the API's capabilities for user webhook management.
…ging Updated the callHookFile function to create a final payload that includes the file parameter. Enhanced logging to provide more detailed information about the payload being sent and the response received, improving traceability and debugging capabilities.
This commit updates the database connection from SQLite to PostgreSQL using the sqlx library. It introduces environment variable loading for database credentials and implements database migrations using the golang-migrate package. Additionally, logging has been improved to provide clearer error messages in both English and Portuguese.
This commit introduces two new routes for managing webhooks: a DELETE method to remove a webhook and a PUT method to update an existing webhook. These additions enhance the webhook functionality and provide more flexibility for users interacting with the API.
…fication This commit introduces new endpoints for user management under , allowing for listing, adding, and deleting users. Additionally, it enhances the webhook functionality with endpoints for setting, updating, and deleting webhooks, along with detailed descriptions and response examples for each operation. The API specification is now more comprehensive, providing clearer guidance for developers integrating with the API.
…ling Refactored the database interactions in to utilize the package for enhanced query capabilities. Updated SQL statements to use positional parameters and improved error handling for JSON marshaling when calling webhooks. Additionally, increased the HTTP client timeout from 5 to 30 seconds to enhance reliability during network operations.
adjust update removing comma
Update wmiau.go
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Descrição (Português)
Esta Pull Request introduz as seguintes melhorias e configurações para a API Wuzapi:
Dockerfile:
golang:1.23-alpine3.20
para compilar o binário da API, instalando as dependências necessárias (comogcc
,musl-dev
egcompat
).alpine:3.20
, instala os pacotes essenciais para a execução da aplicação, incluindotzdata
para suporte a timezones.TZ
como"America/Sao_Paulo"
.ENTRYPOINT
para iniciar o binário com as flags--logtype=console --color=true
, garantindo que os logs sejam exibidos em formato de console colorido.Docker Compose:
8080
.postgres:15
e configura o banco de dados com as variáveis de ambiente apropriadas.Aprimoramentos no Código (main.go):
zerolog
para registrar as mensagens, com suporte à saída em JSON ou em console.--color=true
, os logs são exibidos com cores diferenciadas para cada nível (DEBUG, INFO, WARN, ERROR, etc.) e com timestamps formatados conforme o fuso horário definido.TZ
e ajustatime.Local
de acordo, garantindo que os logs e operações de tempo usem o fuso horário correto.Description (English)
This Pull Request introduces the following improvements and configurations for the Wuzapi API:
Dockerfile:
golang:1.23-alpine3.20
image to compile the API binary, installing the necessary build dependencies (such asgcc
,musl-dev
, andgcompat
).alpine:3.20
image, installs the essential packages for running the application, includingtzdata
for timezone support.TZ
to"America/Sao_Paulo"
.ENTRYPOINT
to run the binary with the flags--logtype=console --color=true
, ensuring that logs are displayed in a colored console format.Docker Compose:
8080
.postgres:15
image and configures the database with the appropriate environment variables.Code Enhancements (main.go):
zerolog
for logging, supporting both JSON and console output.--color=true
, logs are displayed with different colors for each log level (DEBUG, INFO, WARN, ERROR, etc.) and timestamps formatted according to the configured timezone.TZ
environment variable and setstime.Local
accordingly, ensuring that log timestamps and time-based operations use the correct timezone.Instruções / Final Instructions
Build da Imagem / Build the Image:
Subir os Serviços / Start the Services:
Verificar os Logs / Check the Logs:
--color=true
) e os timestamps estarão formatados conforme o timezone configurado.--color=true
), and timestamps will be formatted according to the configured timezone.Arquivos Completos / Complete Files
Dockerfile
docker-compose.yml