Skip to content

Commit

Permalink
Merge pull request #204 from oceanprotocol/feature/add-mapping-elastic
Browse files Browse the repository at this point in the history
Add mapping by default in elastic
  • Loading branch information
Enrique Ruiz authored Jun 28, 2019
2 parents 854ef1b + 4c8bd19 commit 0c582dc
Show file tree
Hide file tree
Showing 10 changed files with 806 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.3.4
current_version = 0.3.5
commit = True
tag = True

Expand Down
17 changes: 13 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,21 @@ dist: xenial

sudo: false

services:
- mongodb
env:
- ES_VERSION=6.6.2 ES_DOWNLOAD_URL=https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-${ES_VERSION}.tar.gz



# Command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors
install: pip install -U tox-travis
script: tox
install:
- wget ${ES_DOWNLOAD_URL}
- tar -xzf elasticsearch-${ES_VERSION}.tar.gz
- ./elasticsearch-${ES_VERSION}/bin/elasticsearch &
- pip install -U tox-travis
script:
- wget -q --waitretry=1 --retry-connrefused -T 10 -O - http://127.0.0.1:9200
- tox

deploy:
provider: pypi
distributions: sdist bdist_wheel
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
History
=======

0.3.5 (June 28st, 2019)
----------------------
* Create mapping for elastic plugin.
* Update swagger doc.

0.3.4 (June 26st, 2019)
----------------------
* Allow free asset only for commons marketplaces.
Expand Down
2 changes: 1 addition & 1 deletion aquarius/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
# SPDX-License-Identifier: Apache-2.0

__author__ = """OceanProtocol"""
__version__ = '0.3.4'
__version__ = '0.3.5'
22 changes: 11 additions & 11 deletions aquarius/app/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
list_errors_dict_remote)

from aquarius.app.dao import Dao
from aquarius.config import Config
from aquarius.log import setup_logging
from aquarius.myapp import app
from aquarius.config import Config

setup_logging()
assets = Blueprint('assets', __name__)
Expand Down Expand Up @@ -136,14 +136,14 @@ def register():
type: array
description: List of public keys.
example: [{"id":
"did:op:0c184915b07b44c888d468be85a9b28253e80070e5294b1aaed81c2f0264e430"},
{"type": "EthereumECDSAKey"},
{"owner": "0x00Bd138aBD70e2F00903268F3Db08f2D25677C9e"}]
"did:op:0c184915b07b44c888d468be85a9b28253e80070e5294b1aaed81c2f0264e430",
"type": "EthereumECDSAKey",
"owner": "0x00Bd138aBD70e2F00903268F3Db08f2D25677C9e"}]
authentication:
type: array
description: List of authentication mechanisms.
example: [{"type": "RsaSignatureAuthentication2018"},
{"publicKey":
example: [{"type": "RsaSignatureAuthentication2018",
"publicKey":
"did:op:0c184915b07b44c888d468be85a9b28253e80070e5294b1aaed81c2f0264e430"}]
proof:
type: dictionary
Expand Down Expand Up @@ -338,14 +338,14 @@ def update(did):
type: array
description: List of public keys.
example: [{"id":
"did:op:0c184915b07b44c888d468be85a9b28253e80070e5294b1aaed81c2f0264e430"},
{"type": "EthereumECDSAKey"},
{"owner": "0x00Bd138aBD70e2F00903268F3Db08f2D25677C9e"}]
"did:op:0c184915b07b44c888d468be85a9b28253e80070e5294b1aaed81c2f0264e430",
"type": "EthereumECDSAKey",
"owner": "0x00Bd138aBD70e2F00903268F3Db08f2D25677C9e"}]
authentication:
type: array
description: List of authentication mechanisms.
example: [{"type": "RsaSignatureAuthentication2018"},
{"publicKey":
example: [{"type": "RsaSignatureAuthentication2018",
"publicKey":
"did:op:0c184915b07b44c888d468be85a9b28253e80070e5294b1aaed81c2f0264e430"}]
proof:
type: dictionary
Expand Down
13 changes: 13 additions & 0 deletions aquarius/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

NAME_AQUARIUS_URL = 'aquarius.url'
ALLOW_FREE_ASSETS_ONLY = 'allowFreeAssetsOnly'
MODULE = 'module'
DB_HOSTNAME = 'db.hostname'
DB_PORT = 'db.port'

environ_names = {
NAME_AQUARIUS_URL: ['AQUARIUS_URL', 'Aquarius URL'],
Expand All @@ -30,6 +33,7 @@ def __init__(self, filename=None, **kwargs):

self.read_dict(config_defaults)
self._section_name = ConfigSections.RESOURCES
self._oceandb_name = ConfigSections.OCEANBD
self._logger = kwargs.get('logger', logging.getLogger(__name__))
self._logger.debug('Config: loading config file %s', filename)

Expand Down Expand Up @@ -64,6 +68,15 @@ def aquarius_url(self):
def allow_free_assets_only(self):
return self.get(self._section_name, ALLOW_FREE_ASSETS_ONLY)

@property
def db_url(self):
return self.get(self._oceandb_name, DB_HOSTNAME) + ":" + self.get(self._oceandb_name,
DB_PORT)

@property
def module(self):
return self.get(self._oceandb_name, MODULE)

# static methods

@staticmethod
Expand Down
Loading

0 comments on commit 0c582dc

Please sign in to comment.