Skip to content

cartesi/rollups-graphql

Repository files navigation

Cartesi's GraphQL

CI Go Report Card

Technical Vision Forum Discussion

Internal docs

Description

Exposes the GraphQL reader API in the endpoint http://127.0.0.1:8080/graphql. You may access this address to use the GraphQL interactive playground in your web browser. You can also make POST requests directly to the GraphQL API. For instance, the command below gets the number of inputs.

QUERY='query { inputs { totalCount } }'; \
curl \
    -X POST \
    -H 'Content-Type: application/json' \
    -d "{\"query\": \"$QUERY\"}" \
    http://127.0.0.1:8080/graphql

Connecting to Postgres locally

Start a Postgres instance locally using docker compose.

make up-db-raw
export POSTGRES_GRAPHQL_DB_URL="postgres://postgres:password@localhost:5432/rlgraphql?sslmode=disable"
export POSTGRES_NODE_DB_URL="postgres://postgres:password@localhost:5432/rollupsdb?sslmode=disable"
./cartesi-rollups-graphql

Environment Variables

The following environment variables are used for PostgreSQL configuration:

  • POSTGRES_GRAPHQL_DB_URL: URL for the PostgreSQL database used by GraphQL.
  • POSTGRES_NODE_DB_URL: URL for the PostgreSQL database used by the node.
  • DB_MAX_OPEN_CONNS: Maximum number of open connections to the database (default: 25).
  • DB_MAX_IDLE_CONNS: Maximum number of idle connections in the pool (default: 10).
  • DB_CONN_MAX_LIFETIME: Maximum amount of time a connection may be reused (default: 1800 seconds).
  • DB_CONN_MAX_IDLE_TIME: Maximum amount of time a connection may be idle (default: 300 seconds).

Contributors

Contributors

Made with contributors-img.