diff --git a/.github/workflows/Unit-Test.yml b/.github/workflows/Unit-Test.yml index 7284bdd5..b9504b0a 100644 --- a/.github/workflows/Unit-Test.yml +++ b/.github/workflows/Unit-Test.yml @@ -61,8 +61,14 @@ jobs: - name: Launch Worker run: | + export OSM_CLIENT_ID=thisisfakeosmcliendid + export OSM_CLIENT_SECRET=thisisclientosm + export APP_SECRET_KEY=thisissecretkey celery --app API.api_worker worker --loglevel=INFO --queues='raw_default' & - name: Run Tests run: | + export OSM_CLIENT_ID=thisisfakeosmcliendid + export OSM_CLIENT_SECRET=thisisclientosm + export APP_SECRET_KEY=thisissecretkey py.test -v -s diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f1370dbc..b689ac9d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -66,13 +66,20 @@ jobs: python -m pip install --upgrade pip pip install -r requirements.txt pip install -e . + - name: Run uvicorn server run: | + export OSM_CLIENT_ID=thisisfakeosmcliendid + export OSM_CLIENT_SECRET=thisisclientosm + export APP_SECRET_KEY=thisissecretkey uvicorn API.main:app &> uvicorn.log & env: PORT: 8000 - name: Run celery server run: | + export OSM_CLIENT_ID=thisisfakeosmcliendid + export OSM_CLIENT_SECRET=thisisclientosm + export APP_SECRET_KEY=thisissecretkey celery --app API.api_worker worker --loglevel=DEBUG &> worker.log & - name: Run flower dashboard run: | diff --git a/config.txt.sample b/config.txt.sample index b9a09c9a..937c0cdc 100644 --- a/config.txt.sample +++ b/config.txt.sample @@ -19,8 +19,8 @@ PGDATABASE=rawdata # for scope. Callback / Redirect URI should be set when the OAuth2 app # is created on OSM portal. App secret key is a high-entropy string. [OAUTH] -OSM_CLIENT_ID=0yhbzr7-e0F-DGgyxXOyq2Y4d_sYLflMzVvLIfRtxHg -OSM_CLIENT_SECRET= KI59u4PLCQFAd8Vo2oewaHNmlf2EfTcfGgwWd2VCtk8 +OSM_CLIENT_ID=0yhbzr7-e0F-DGgyxXOyq2Y4d_sYLfdflMzVvLIfRtxHg +OSM_CLIENT_SECRET= KI59u4PLCQFAd8Vo2oewaHNmlf2EfTcfGgwWd2VCsdtk8 ;OSM_URL=https://www.openstreetmap.org ;OSM_PERMISSION_SCOPE=read_prefs LOGIN_REDIRECT_URI=http://raw-data-test.example.net:8000/v1/auth/callback/ diff --git a/src/app.py b/src/app.py index b84e5520..adc91e34 100644 --- a/src/app.py +++ b/src/app.py @@ -466,12 +466,6 @@ def get_grid_id(geom, cur): countries = backend_match[0] country_export = True logging.debug(f"Using Country Export Mode with id : {countries[0]}") - else: - if int(geom_area) > int(EXPORT_MAX_AREA_SQKM): - raise ValueError( - f"""Polygon Area {int(geom_area)} Sq.KM is higher than Threshold : {EXPORT_MAX_AREA_SQKM} Sq.KM""" - ) - # else: # if int(geom_area) > int(index_threshold): # # this will be applied only when polygon gets bigger we will be slicing index size to search diff --git a/src/config.py b/src/config.py index 290f5d9c..deaea7df 100644 --- a/src/config.py +++ b/src/config.py @@ -209,7 +209,7 @@ def get_oauth_credentials() -> tuple: "OAUTH", "APP_SECRET_KEY" ) login_redirect_uri = os.environ.get("LOGIN_REDIRECT_URI") or config.get( - "OAUTH", "LOGIN_REDIRECT_URI" + "OAUTH", "LOGIN_REDIRECT_URI", fallback="http://127.0.0.1:8000/v1/auth/callback" ) scope = os.environ.get("OSM_PERMISSION_SCOPE") or config.get( "OAUTH", "OSM_PERMISSION_SCOPE", fallback="read_prefs" diff --git a/src/query_builder/builder.py b/src/query_builder/builder.py index d2809f2f..d543f564 100644 --- a/src/query_builder/builder.py +++ b/src/query_builder/builder.py @@ -55,8 +55,8 @@ def check_exisiting_country(geom): from countries b where - ST_Equals(ST_GEOMFROMGEOJSON('{geom}') , - b.geometry) + ST_Equals(ST_SnapToGrid(ST_GEOMFROMGEOJSON('{geom}'),0.00001) , + ST_SnapToGrid(b.geometry,0.00001)) """ return query