feat: add meta-auth (#4)
All checks were successful
continuous-integration/drone/push Build is passing

Co-authored-by: William Luke <williamluke4@gmail.com>
Reviewed-on: #4
Co-authored-by: williamluke <williamluke4@gmail.com>
Co-committed-by: williamluke <williamluke4@gmail.com>
This commit was merged in pull request #4.
This commit is contained in:
2022-07-04 10:37:40 +00:00
parent c3e5ee3199
commit bfe7086178
10 changed files with 640 additions and 507 deletions

View File

@@ -4,8 +4,12 @@ import logging
import os
from typing import List
# External imports
from chainlib.chain import ChainSpec
from chainlib.cli.config import Config
from cic_types.ext.metadata import MetadataRequestsHandler
from cic_types.ext.metadata.signer import Signer as MetadataSigner
# Local Modules
from cic.contract.components.attachment import Attachment
from cic.contract.components.meta import Meta
@@ -15,9 +19,7 @@ from cic.contract.helpers import init_writers_from_config
from cic.contract.network import Network
from cic.contract.processor import ContractProcessor
from cic.writers import HTTPWriter, KeyedWriterFactory, MetadataWriter
# external imports
from cic_types.ext.metadata import MetadataRequestsHandler
from cic_types.ext.metadata.signer import Signer as MetadataSigner
log = logging.getLogger(__name__)
@@ -146,9 +148,12 @@ def deploy_contract(
output_writer_path_meta = output_directory
metadata_endpoint = config.get("META_URL")
metadata_auth_token = config.get("META_AUTH_TOKEN")
if metadata_endpoint is not None:
MetadataRequestsHandler.base_url = metadata_endpoint
MetadataRequestsHandler.auth_token = metadata_auth_token
MetadataSigner.gpg_path = "/tmp"
MetadataSigner.key_file_path = config.get("AUTH_KEYFILE_PATH")
MetadataSigner.gpg_passphrase = config.get("AUTH_PASSPHRASE")