diff --git a/backend/configs/sample.env b/backend/configs/sample.env new file mode 100644 index 00000000..e4d7418a --- /dev/null +++ b/backend/configs/sample.env @@ -0,0 +1,23 @@ +# Required environment variables +export MOONSTREAM_DB_URI="postgresql://:@:/" +export MOONSTREAM_CORS_ALLOWED_ORIGINS="http://localhost:3000,https://moonstream.to,https://www.moonstream.to" +export BUGOUT_BROOD_URL="https://auth.bugout.dev" +export BUGOUT_SPIRE_URL="https://spire.bugout.dev" +export MOONSTREAM_APPLICATION_ID="" +export MOONSTREAM_ADMIN_ACCESS_TOKEN="" +export MOONSTREAM_POOL_SIZE=0 + +# Blockchain, txpool, whalewatch data depends variables +export MOONSTREAM_DATA_JOURNAL_ID="" +export HUMBUG_TXPOOL_CLIENT_ID="" +export MOONSTREAM_ETHEREUM_WEB3_PROVIDER_URI="https://" +export MOONSTREAM_NODE_ETHEREUM_IPC_PORT=8545 + +# Set following parameters if AWS node instance and S3 smartcontracts configured +export MOONSTREAM_INTERNAL_HOSTED_ZONE_ID="" +export MOONSTREAM_S3_SMARTCONTRACTS_BUCKET="" +export MOONSTREAM_S3_SMARTCONTRACTS_ABI_BUCKET="" +export MOONSTREAM_S3_SMARTCONTRACTS_ABI_PREFIX="" + +# Set the following variables in the most reasonable manner for your development environment +export HUMBUG_REPORTER_BACKEND_TOKEN="" diff --git a/backend/moonstreamapi/providers/bugout.py b/backend/moonstreamapi/providers/bugout.py index f7b29f76..d4081df7 100644 --- a/backend/moonstreamapi/providers/bugout.py +++ b/backend/moonstreamapi/providers/bugout.py @@ -16,7 +16,7 @@ from sqlalchemy.orm import Session from .. import data from ..stream_queries import StreamQuery -from ..settings import ETHTXPOOL_HUMBUG_CLIENT_ID +from ..settings import HUMBUG_TXPOOL_CLIENT_ID logger = logging.getLogger(__name__) logger.setLevel(logging.WARN) @@ -382,7 +382,7 @@ ethereum_txpool_provider = EthereumTXPoolProvider( description=ethereum_txpool_description, default_time_interval_seconds=5, estimated_events_per_time_interval=50, - tags=[f"client:{ETHTXPOOL_HUMBUG_CLIENT_ID}"], + tags=[f"client:{HUMBUG_TXPOOL_CLIENT_ID}"], ) nft_summary_description = """Event provider for NFT market summaries. diff --git a/backend/moonstreamapi/settings.py b/backend/moonstreamapi/settings.py index c491ddc7..c2bfc750 100644 --- a/backend/moonstreamapi/settings.py +++ b/backend/moonstreamapi/settings.py @@ -39,14 +39,14 @@ DOCS_TARGET_PATH = "docs" DEFAULT_STREAM_TIMEINTERVAL = 5 * 60 -ETHTXPOOL_HUMBUG_CLIENT_ID = os.environ.get( - "ETHTXPOOL_HUMBUG_CLIENT_ID", "client:ethereum-txpool-crawler-0" +HUMBUG_TXPOOL_CLIENT_ID = os.environ.get( + "HUMBUG_TXPOOL_CLIENT_ID", "client:ethereum-txpool-crawler-0" ) # S3 Bucket -ETHERSCAN_SMARTCONTRACTS_BUCKET = os.environ.get("AWS_S3_SMARTCONTRACT_BUCKET") +ETHERSCAN_SMARTCONTRACTS_BUCKET = os.environ.get("MOONSTREAM_S3_SMARTCONTRACTS_BUCKET") if ETHERSCAN_SMARTCONTRACTS_BUCKET is None: - raise ValueError("AWS_S3_SMARTCONTRACT_BUCKET is not set") + raise ValueError("MOONSTREAM_S3_SMARTCONTRACTS_BUCKET is not set") MOONSTREAM_INTERNAL_HOSTED_ZONE_ID = os.environ.get( "MOONSTREAM_INTERNAL_HOSTED_ZONE_ID", "" diff --git a/backend/moonstreamapi/web3_provider.py b/backend/moonstreamapi/web3_provider.py index 719de079..946eb380 100644 --- a/backend/moonstreamapi/web3_provider.py +++ b/backend/moonstreamapi/web3_provider.py @@ -32,7 +32,7 @@ def fetch_web3_provider_ip(): return record_value -if not MOONSTREAM_ETHEREUM_WEB3_PROVIDER_URI.replace(".", "").isnumeric(): +if not MOONSTREAM_ETHEREUM_WEB3_PROVIDER_URI.startswith("http"): web3_provider_ip = fetch_web3_provider_ip() if web3_provider_ip is None: raise ValueError("Unable to extract web3 provider IP") diff --git a/backend/sample.env b/backend/sample.env deleted file mode 100644 index 8b3d4fa4..00000000 --- a/backend/sample.env +++ /dev/null @@ -1,15 +0,0 @@ -export MOONSTREAM_CORS_ALLOWED_ORIGINS="http://localhost:3000,https://moonstream.to,https://www.moonstream.to" -export MOONSTREAM_APPLICATION_ID="" -export MOONSTREAM_DATA_JOURNAL_ID="" -export MOONSTREAM_DB_URI="postgresql://:@:/" -export MOONSTREAM_POOL_SIZE=0 -export MOONSTREAM_ADMIN_ACCESS_TOKEN="" -export MOONSTREAM_INTERNAL_HOSTED_ZONE_ID="" -export MOONSTREAM_ETHEREUM_WEB3_PROVIDER_URI="" -export AWS_S3_SMARTCONTRACT_BUCKET="" -export MOONSTREAM_S3_SMARTCONTRACTS_ABI_BUCKET="" -export MOONSTREAM_S3_SMARTCONTRACTS_ABI_PREFIX="" -export BUGOUT_BROOD_URL="https://auth.bugout.dev" -export BUGOUT_SPIRE_URL="https://spire.bugout.dev" -export HUMBUG_REPORTER_BACKEND_TOKEN="" -export ETHTXPOOL_HUMBUG_CLIENT_ID="" diff --git a/crawlers/mooncrawl/mooncrawl/etherscan.py b/crawlers/mooncrawl/mooncrawl/etherscan.py index 5ec96ed6..0ee24441 100644 --- a/crawlers/mooncrawl/mooncrawl/etherscan.py +++ b/crawlers/mooncrawl/mooncrawl/etherscan.py @@ -29,9 +29,9 @@ BASE_API_URL = "https://api.etherscan.io/api?module=contract&action=getsourcecod ETHERSCAN_SMARTCONTRACTS_LABEL_NAME = "etherscan_smartcontract" -bucket = os.environ.get("AWS_S3_SMARTCONTRACT_BUCKET") +bucket = os.environ.get("MOONSTREAM_S3_SMARTCONTRACTS_BUCKET") if bucket is None: - raise ValueError("AWS_S3_SMARTCONTRACT_BUCKET must be set") + raise ValueError("MOONSTREAM_S3_SMARTCONTRACTS_BUCKET must be set") @dataclass diff --git a/crawlers/mooncrawl/sample.env b/crawlers/mooncrawl/sample.env index f6ff4d9b..a58f54ce 100644 --- a/crawlers/mooncrawl/sample.env +++ b/crawlers/mooncrawl/sample.env @@ -8,7 +8,7 @@ export MOONSTREAM_NODE_POLYGON_IPC_PORT="8545" export MOONSTREAM_CRAWL_WORKERS=4 export MOONSTREAM_DB_URI="postgresql://:@:/" export MOONSTREAM_ETHERSCAN_TOKEN="" -export AWS_S3_SMARTCONTRACT_BUCKET="" +export MOONSTREAM_S3_SMARTCONTRACTS_BUCKET="" export MOONSTREAM_S3_SMARTCONTRACTS_ABI_PREFIX="" export MOONSTREAM_HUMBUG_TOKEN="" export COINMARKETCAP_API_KEY="" diff --git a/db/alembic.sample.ini b/db/configs/alembic.sample.ini similarity index 100% rename from db/alembic.sample.ini rename to db/configs/alembic.sample.ini diff --git a/db/sample.env b/db/configs/sample.env similarity index 67% rename from db/sample.env rename to db/configs/sample.env index 4e3db953..c5409401 100644 --- a/db/sample.env +++ b/db/configs/sample.env @@ -1,2 +1,3 @@ +# Required environment variables to work with database CLI export MOONSTREAM_DB_URI="postgresql://:@:/" export MOONSTREAM_POOL_SIZE=0