Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require 'ljsonschema' only when the validation of schemas is enabled #660

Merged
merged 2 commits into from
Mar 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

### Fixed

- `ljsonschema` is only used in testing but was required in production also [PR #660](https://github.com/3scale/apicast/pull/660)

## [3.2.0-beta2] - 2018-03-19

### Added
Expand Down
7 changes: 5 additions & 2 deletions gateway/src/apicast/policy_loader.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ local insert = table.insert
local setmetatable = setmetatable
local pcall = pcall

local policy_config_validator = require('apicast.policy_config_validator')

local _M = {}

local resty_env = require('resty.env')
Expand Down Expand Up @@ -49,6 +47,11 @@ local function policy_config_validation_is_enabled()
or resty_env.value('TEST_NGINX_BINARY')
end

local policy_config_validator = { validate_config = function() return true end }
if policy_config_validation_is_enabled() then
policy_config_validator = require('apicast.policy_config_validator')
end

local function read_manifest(path)
local handle = io.open(format('%s/%s', path, 'apicast-policy.json'))

Expand Down