Skip to content

Commit

Permalink
fix(config) proper name for C* username auth scheme
Browse files Browse the repository at this point in the history
kong.yml proposed this property as `user` wether the real name of the
property is in fact `username` as seen in the config defaults and the
Cassandra DAO Factory.
  • Loading branch information
thibaultcha committed Jan 30, 2016
1 parent 650f3fd commit a3593db
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 15 deletions.
20 changes: 10 additions & 10 deletions kong.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
######
## A dictionary of DNS resolvers Kong can use, and their respective properties.
## Currently `dnsmasq` (default, http://www.thekelleys.org.uk/dnsmasq/doc.html) and `server` are supported.
## By choosing `dnsmasq`, Kong will resolve hostnames using the local `/etc/hosts` file and `resolv.conf`
## By choosing `dnsmasq`, Kong will resolve hostnames using the local `/etc/hosts` file and `resolv.conf`
## configuration. By choosing `server`, you can specify a custom DNS server.
# dns_resolvers_available:
# server:
Expand All @@ -68,7 +68,7 @@
# port: 8053

######
## Cluster settings between Kong nodes.
## Cluster settings between Kong nodes.
## For more information take a look at the Clustering Reference: https://getkong.org/docs/latest/clustering/
# cluster:

Expand All @@ -77,8 +77,8 @@
## TCP messages. All the nodes in the cluster must be able to communicate with this node on this address.
## Only IPv4 addresses are allowed (no hostnames).
## The advertise flag is used to change the address that we advertise to other nodes in the
## cluster. By default, the cluster_listen address is advertised. However, in some cases
## (specifically NAT traversal), there may be a routable address that cannot be bound to.
## cluster. By default, the cluster_listen address is advertised. However, in some cases
## (specifically NAT traversal), there may be a routable address that cannot be bound to.
## This flag enables gossiping a different address to support this.
# advertise: ""

Expand Down Expand Up @@ -136,18 +136,18 @@
######
## Cluster authentication options. Provide a user and a password here if your cluster uses the
## PasswordAuthenticator scheme.
# user: cassandra
# username: cassandra
# password: cassandra

######
## Kong will send anonymous reports to Mashape. This helps Mashape fixing bugs/errors and improving Kong.
## Kong will send anonymous reports to Mashape. This helps Mashape fixing bugs/errors and improving Kong.
## By default is `true`.
# send_anonymous_reports: true

######
## A value specifying (in MB) the size of the internal preallocated in-memory cache. Kong uses an in-memory
## cache to store database entities in order to optimize access to the underlying datastore. The cache size
## needs to be as big as the size of the entities being used by Kong at any given time. The default value
## A value specifying (in MB) the size of the internal preallocated in-memory cache. Kong uses an in-memory
## cache to store database entities in order to optimize access to the underlying datastore. The cache size
## needs to be as big as the size of the entities being used by Kong at any given time. The default value
## is `128`, and the potential maximum value is the total size of the datastore.
## This value may not be smaller than 32MB.
# memory_cache_size: 128
Expand Down Expand Up @@ -314,4 +314,4 @@ nginx: |
return 200 'User-agent: *\nDisallow: /';
}
}
}
}
2 changes: 1 addition & 1 deletion kong/cli/services/nginx.lua
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ local function prepare_nginx_configuration(configuration, ssl_config)
ssl_cert = ssl_config.ssl_cert_path,
ssl_key = ssl_config.ssl_key_path,
lua_ssl_trusted_certificate = ssl_config.trusted_ssl_cert_path and
'lua_ssl_trusted_certificate "'..configuration.dao_config.ssl.certificate_authority..'";'
'lua_ssl_trusted_certificate "'..configuration.dao_config.ssl.certificate_authority..'";' or ""
}

-- Auto-tune
Expand Down
33 changes: 29 additions & 4 deletions spec/unit/dao/cassandra/factory_spec.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
local Factory = require "kong.dao.cassandra.factory"
local utils = require "kong.tools.utils"
local spec_helpers = require "spec.spec_helpers"
local env = spec_helpers.get_env()
local default_dao_properties = env.configuration.cassandra
Expand All @@ -7,7 +8,8 @@ describe("Cassadra factory", function()
describe("get_session_options()", function()
local dao_properties
before_each(function()
dao_properties = default_dao_properties
-- TODO switch to new default config getter and shallow copy in feature/postgres
dao_properties = utils.deep_copy(default_dao_properties)
end)
it("should reflect the default config", function()
local factory = Factory(dao_properties)
Expand Down Expand Up @@ -50,9 +52,32 @@ describe("Cassadra factory", function()
}
}, options)
end)
it("should accept authentication properties", function()
dao_properties.username = "cassie"
dao_properties.password = "cassiepwd"

local factory = Factory(dao_properties)
assert.truthy(factory)
local options = factory:get_session_options()
assert.truthy(options)
assert.same({
shm = "cassandra",
prepared_shm = "cassandra_prepared",
contact_points = {"127.0.0.1:9042"},
keyspace = "kong_tests",
query_options = {
prepare = true
},
ssl_options = {
enabled = false,
verify = false
},
username = "cassie",
password = "cassiepwd"
}, options)
end)
it("should accept SSL properties", function()
dao_properties.contact_points = {"127.0.0.1:9042"}
dao_properties.keyspace = "my_keyspace"
dao_properties.ssl.enabled = false
dao_properties.ssl.verify = true

Expand All @@ -64,7 +89,7 @@ describe("Cassadra factory", function()
shm = "cassandra",
prepared_shm = "cassandra_prepared",
contact_points = {"127.0.0.1:9042"},
keyspace = "my_keyspace",
keyspace = "kong_tests",
query_options = {
prepare = true
},
Expand All @@ -84,7 +109,7 @@ describe("Cassadra factory", function()
shm = "cassandra",
prepared_shm = "cassandra_prepared",
contact_points = {"127.0.0.1:9042"},
keyspace = "my_keyspace",
keyspace = "kong_tests",
query_options = {
prepare = true
},
Expand Down

0 comments on commit a3593db

Please sign in to comment.