Skip to content

Commit

Permalink
fix: merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
DhananjayPurohit committed Apr 24, 2024
1 parent 36e270e commit ed2a5a1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,9 @@ jobs:
file: ./keylistCron/Dockerfile
push: true
tags: commerceblockx/keylist-cronjob:latest
env:
DB_HOST: ${{ secrets.DB_HOST }}
DB_PORT: ${{ secrets.DB_PORT }}
DB_NAME: ${{ secrets.DB_NAME }}
DB_USER: ${{ secrets.DB_USER }}
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
2 changes: 1 addition & 1 deletion keylistCron/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM alpine:latest

RUN apk update && apk add --no-cache curl postgresql-client
RUN apk update && apk add --no-cache curl postgresql-client jq
WORKDIR /app

COPY ../keylistCron/send_commitment.sh .
Expand Down
11 changes: 8 additions & 3 deletions keylistCron/send_commitment.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash

# Fetch keylist JSON from the provided URL
KEYLIST_URL="http://45.77.225.72:32450/info/keylist"
KEYLIST_JSON=$(curl -sSL "$KEYLIST_URL")
KEYLIST_URL="https://api.mercurywallet.io/info/keylist"
KEYLIST_JSON=$(curl -sSL "$KEYLIST_URL" | jq -r '.list_keyinfo')

# Check if the GET request was successful
if [[ $? -ne 0 ]]; then
Expand Down Expand Up @@ -39,7 +39,12 @@ fi
echo "Keylist $KEYLIST_HASH attestation completed successfully!"

# Connect to the database and save the keylist JSON
PG_COMMAND="psql -h $DB_HOST -p $DB_PORT -d $DB_NAME -U $DB_USER -c \"INSERT INTO keylist (json_data) VALUES ('$KEYLIST_JSON');\""
PG_COMMAND="PGPASSWORD=\"$DB_PASSWORD\" psql -h $DB_HOST -p $DB_PORT -d $DB_NAME -U $DB_USER -c \"
CREATE TABLE IF NOT EXISTS keylist_info (
json_data json NOT NULL
);
INSERT INTO keylist_info (json_data) VALUES ('$KEYLIST_JSON');
\""

# Execute the PostgreSQL command
eval "$PG_COMMAND"
Expand Down

0 comments on commit ed2a5a1

Please sign in to comment.