-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ac1177b
commit 01cbe38
Showing
3 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
...s/snippets/config/instances.enabled/application_validate_cfg_record_hierarchy/config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
groups: | ||
group001: | ||
replicasets: | ||
replicaset001: | ||
instances: | ||
instance001: | ||
roles: [ http_api ] | ||
roles_cfg: | ||
http_api: | ||
listen_address: | ||
host: '127.0.0.1' | ||
port: 8080 | ||
scheme: 'http' |
32 changes: 32 additions & 0 deletions
32
.../snippets/config/instances.enabled/application_validate_cfg_record_hierarchy/http_api.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
-- http_api.lua -- | ||
local log = require('log').new("http_api") | ||
local schema = require('experimental.config.utils.schema') | ||
|
||
local listen_address_schema = schema.new('listen_address', schema.record({ | ||
listen_address = schema.record({ | ||
scheme = schema.enum({ 'http', 'https' }), | ||
host = schema.scalar({ type = 'string' }), | ||
port = schema.scalar({ type = 'integer' }) | ||
}) | ||
})) | ||
|
||
local function validate(cfg) | ||
listen_address_schema:validate(cfg) | ||
end | ||
|
||
local function apply(cfg) | ||
local scheme = listen_address_schema:get(cfg, 'listen_address.scheme') | ||
local host = listen_address_schema:get(cfg, 'listen_address.host') | ||
local port = listen_address_schema:get(cfg, 'listen_address.port') | ||
log.info("HTTP API endpoint: %s://%s:%d", scheme, host, port) | ||
end | ||
|
||
local function stop() | ||
log.info("The 'http_api' role is stopped") | ||
end | ||
|
||
return { | ||
validate = validate, | ||
apply = apply, | ||
stop = stop, | ||
} |
1 change: 1 addition & 0 deletions
1
...snippets/config/instances.enabled/application_validate_cfg_record_hierarchy/instances.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
instance001: |