-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from gnosischain/feature/add-database
Feature/add database
- Loading branch information
Showing
25 changed files
with
586 additions
and
211 deletions.
There are no files selected for viewing
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 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 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,20 @@ | ||
FROM python:3.8-alpine | ||
FROM python:3.10-alpine | ||
|
||
COPY requirements.txt /tmp/requirements.txt | ||
RUN pip install --no-cache-dir -r /tmp/requirements.txt | ||
|
||
COPY . /api | ||
ENV PYTHONUNBUFFERED 1 | ||
WORKDIR /api | ||
|
||
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "api:create_app()"] | ||
COPY requirements.txt ./ | ||
|
||
# Signal handling for PID1 https://github.com/krallin/tini | ||
RUN apk add --update --no-cache tini libpq && \ | ||
apk add --no-cache --virtual .build-dependencies alpine-sdk libffi-dev && \ | ||
pip install --no-cache-dir -r requirements.txt && \ | ||
apk del .build-dependencies && \ | ||
find /usr/local \ | ||
\( -type d -a -name test -o -name tests \) \ | ||
-o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \ | ||
-exec rm -rf '{}' + | ||
|
||
COPY . . | ||
|
||
ENTRYPOINT ["/sbin/tini", "--"] |
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,16 @@ | ||
NATIVE_TOKEN_ADDRESS='native' | ||
from enum import Enum | ||
|
||
NATIVE_TOKEN_ADDRESS = 'native' | ||
DEFAULT_NATIVE_MAX_AMOUNT_PER_DAY = 0.01 | ||
DEFAULT_ERC20_MAX_AMOUNT_PER_DAY = 0.01 | ||
|
||
CHAIN_NAMES = { | ||
1: 'ETHEREUM MAINNET', | ||
100: 'GNOSIS CHAIN', | ||
10200: 'CHIADO CHAIN' | ||
} | ||
|
||
|
||
class FaucetRequestType(Enum): | ||
web = 'web' | ||
cli = 'cli' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import logging | ||
|
||
import click | ||
from flask import current_app | ||
from flask.cli import with_appcontext | ||
|
||
from .services.database import AccessKey, AccessKeyConfig | ||
from .utils import generate_access_key | ||
|
||
|
||
@click.command(name='create_access_keys') | ||
@with_appcontext | ||
def create_access_keys_cmd(): | ||
access_key_id, secret_access_key = generate_access_key() | ||
access_key = AccessKey() | ||
access_key.access_key_id = access_key_id | ||
access_key.secret_access_key = secret_access_key | ||
access_key.save() | ||
|
||
config = AccessKeyConfig() | ||
config.access_key_id = access_key.access_key_id | ||
config.chain_id = current_app.config["FAUCET_CHAIN_ID"] | ||
config.save() | ||
|
||
logging.info(f'Access Key ID : ${access_key_id}') | ||
logging.info(f'Secret access key: ${secret_access_key}') |
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 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 file was deleted.
Oops, something went wrong.
Oops, something went wrong.