diff --git a/.env b/.env index dc782fb..e962084 100755 --- a/.env +++ b/.env @@ -53,3 +53,10 @@ S3_ACCESS_KEY= S3_SECRET_KEY= S3_BUCKET=dev-ign-mut-validtri S3_REGION=sbg + +### validator-worker/validator-cli postgis +DB_URL=jdbc:postgresql:${PGDATABASE} +DB_USER=${POSTGRES_USER} +DB_PASSWORD=${POSTGRES_PASSWORD} +# must stay empty +DB_SCHEMA= diff --git a/docs/specs/schema/validator-arguments.json b/docs/specs/schema/validator-arguments.json index 155c0a4..4ba54d6 100644 --- a/docs/specs/schema/validator-arguments.json +++ b/docs/specs/schema/validator-arguments.json @@ -76,6 +76,21 @@ "UTF-8", "LATIN1" ] + }, + "dgpr-tolerance": { + "type": "integer", + "description": "tolerance expresed in meter", + "example": 10 + }, + "dgpr-simplify": { + "type": "integer", + "description": "geometry simplification before postgis validation expresed in meters", + "example": 2 + }, + "dgpr-safe-simplify": { + "type": "boolean", + "description": "geometry simplification method", + "example": true } }, "additionalProperties": false diff --git a/src/Controller/Api/ValidationsController.php b/src/Controller/Api/ValidationsController.php index da6cddd..a76657c 100755 --- a/src/Controller/Api/ValidationsController.php +++ b/src/Controller/Api/ValidationsController.php @@ -104,6 +104,35 @@ public function getValidation($uid) return new JsonResponse($this->serializer->toArray($validation), Response::HTTP_OK); } + /** + * @Route( + * "/{uid}/console", + * name="validator_api_read_console", + * methods={"GET"} + * ) + */ + public function readConsole($uid) + { + $validation = $this->repository->findOneByUid($uid); + if (!$validation) { + throw new ApiException("No record found for uid=$uid", Response::HTTP_NOT_FOUND); + } + + if ($validation->getStatus() == Validation::STATUS_ARCHIVED) { + throw new ApiException("Validation has been archived", Response::HTTP_FORBIDDEN); + } + + $validationDirectory = $this->storage->getDirectory($validation) ; + $filepath = $validationDirectory . '/validator-debug.log'; + + $content = file_get_contents($filepath, true); + + return new Response( + $content, + Response::HTTP_CREATED + ); + } + /** * @Route( diff --git a/src/Validation/ValidatorCLI.php b/src/Validation/ValidatorCLI.php index 2879c3e..b0b0ad9 100644 --- a/src/Validation/ValidatorCLI.php +++ b/src/Validation/ValidatorCLI.php @@ -71,8 +71,8 @@ public function process(Validation $validation) /* prepare validator-cli.jar command */ $env = $_ENV; + $env['DB_SCHEMA'] = "validation" . $validation->getUid(); $env['GMLAS_CONFIG'] = $this->gmlasConfigPath; - $sourceDataDir = $validationDirectory.'/'.$validation->getDatasetName(); $cmd = ['java'];