Skip to content

Commit

Permalink
Fixed #13
Browse files Browse the repository at this point in the history
  • Loading branch information
malaskowski committed Jul 4, 2018
1 parent 9d101fa commit 1db2bf7
Show file tree
Hide file tree
Showing 29 changed files with 604 additions and 142 deletions.
15 changes: 11 additions & 4 deletions acme-cluster/core/conf/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ modules = [
"fsRepo=io.knotx.repository.fs.FilesystemRepositoryConnectorVerticle"
"splitter=io.knotx.splitter.FragmentSplitterVerticle"
"assembler=io.knotx.assembler.FragmentAssemblerVerticle"
"serviceKnot=io.knotx.knot.service.ServiceKnotVerticle"
"dataBridge=io.knotx.databridge.core.DataBridgeKnot"
"actionKnot=io.knotx.knot.action.ActionKnotVerticle"
]

Expand All @@ -20,7 +20,6 @@ global {
fsRepo = knotx.core.repository.filesystem

knot {
service = knotx.knot.service
hbs = knotx.knot.handlebars
action = knotx.knot.action
gateway = knotx.gateway.gatewayknot
Expand All @@ -37,6 +36,14 @@ global {
domain = repo-mock
port = 3001
}

# Data Bridge globals
bridge {
address = knotx.knot.databridge
dataSource {
http.address = knotx.bridge.datasource.http
}
}
}

########### Modules configurations ###########
Expand Down Expand Up @@ -71,9 +78,9 @@ config.hbsKnot {
options.config.cacheSize = 1000
}

config.serviceKnot {
config.dataBridge {
options.config {
include required("includes/serviceKnot.conf")
include required("includes/dataBridge.conf")
}
}

Expand Down
46 changes: 46 additions & 0 deletions acme-cluster/core/conf/includes/dataBridge.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Event bus settings
address = ${global.bridge.address}

# List of mappings between service aliases and datasources.
# You can define here as many service definitions as required for your project.
dataDefinitions = [
# Definition of the single datasource to be used in the HTML snippets.
# You can define an array of such services here.
{
# Name of the service that will be used in HTML snippets
#
name = first-service

# Event bus address of the datasource that is responsible for handling physicall communication
# with a data source
# Remember that this addres should be exacly the same as one defined in datasource config
#
adapter = ${global.bridge.dataSource.http.address}

# Arbitrary parameters to be send to datasource.
# Keep in mind, the actuall parameters to be send are the params object from HTML snippet
# merged with values defined here.
#
params.path = /service/first.json
cacheKey = first
},
{
name = second-service
adapter = ${global.bridge.dataSource.http.address}
params.path = /service/second.json
},
{
name = third-service
adapter = ${global.bridge.dataSource.http.address}
params.path = /service/third.json
},
{
name = labelsRepository
address = ${global.bridge.dataSource.http.address}
}
]

# Vert.x event bus delivery options used when communicating with other verticles
# see http://vertx.io/docs/vertx-core/dataobjects.html#DeliveryOptions for the details what can be configured
#
# deliveryOptions {}
31 changes: 0 additions & 31 deletions acme-cluster/core/conf/includes/serviceKnot.conf

This file was deleted.

6 changes: 3 additions & 3 deletions acme-cluster/core/knotx-stack.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
//
{
"variables": {
"vertx.version": "3.5.0",
"vertx.version": "3.5.1",
"tcnative.version": "2.0.7.Final",
"knotx.version": "1.3.0-SNAPSHOT",
"acme.version": "1.3.0-SNAPSHOT"
"knotx.version": "1.3.1-SNAPSHOT",
"acme.version": "1.3.1-SNAPSHOT"
},
"dependencies": [
//Project dependencies
Expand Down
File renamed without changes.
27 changes: 27 additions & 0 deletions acme-cluster/dataSourceHttp/conf/application.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
########### Modules to start ###########
modules = [
"dataSourceHttp=io.knotx.databridge.http.HttpDataSourceAdapter"
]

########### Globals ###########
global {
# Data Bridge globals
bridge {
address = knotx.knot.databridge
dataSource {
http.address = knotx.bridge.datasource.http
}
}

httpService {
domain = service-mock
port = 3000
}
}

########### Modules configurations ###########
config.dataSourceHttp {
options.config {
include required("includes/dataSourceHttp.conf")
}
}
83 changes: 83 additions & 0 deletions acme-cluster/dataSourceHttp/conf/includes/dataSourceHttp.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Event bus address of the Basic HTTP Datasource
address = ${global.bridge.dataSource.http.address}

clientOptions {
maxPoolSize = 1000
idleTimeout = 120 # seconds

# If your datasources are using SSL you'd need to configure here low level details on how the
# SSL connection is to be maintaned. Currently, if configured all defined in 'datasources' section
# will use SSL
#
# Enable SSL
# ssl = true
#
# Whether all server certificated should be trusted or not (e.g. self-signed certificates)
# trustAll = true
#
# Hostname verification
# verifyHost = false
#
# Enables network activity logger (Netty). Remember you also need to include additional logger
# configuration in the logback config:
# <include resource="io/knotx/logging/logback/netty.xml" />
#
# logActivity = true
}

# List of datasource services that are supported by this datasource adapter.
# You can define here as many service definitions as required for your project.
services = [
{
# A regexp.
# Any request to the datasource made by the adapter, is being made to the service with a given
# physical conenction details, only if the given path matching this path regexp
#
path = "/.*"

# A domain or IP of actual HTTP service the adapter will talk to
#
domain = ${global.httpService.domain}

# HTTP port of the service
#
port = ${global.httpService.port}

# List of request headers that will be send to the given service endpoint.
# Each header can be use wildcards '*' to generalize list
# E.g.
# allowedRequestHeaders = [
# "X-.*"
# ]
# By default all requests headers are denied. If you want to enable a desired headers you can
# express it as an array of regexp expressions, e.g. "X-.*" to allow all headers starting
# with "X-", or simply ".*" to allow all headers.
# Be careful what headers you're trying to pass through as some of them might affect the
# communication with the service.
#
allowedRequestHeaders = [ ]

# Additional request query parameters to be send in each request.
# E.g.
# queryParams {
# type = books
# query = java
# }
#
queryParams {}

# Additional headers to be send in each request to the service
# E.g:
# additionalHeaders {
# someToken = abxcdsafsfdfes
# }
#
additionalHeaders {}
}
]

# Statically defined HTTP request header sent in every request to any datasource
customRequestHeader {
name = X-User-Agent
value = Knot.x
}
4 changes: 2 additions & 2 deletions acme-cluster/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ services:
image: acme-handlebars-bare:latest
command: ["bare", "--hagroup hbs-group", "--quorum 2"]
service-adapter:
build: ./serviceAdapter
image: acme-service-adapter:latest
build: ./dataSourceHttp
image: acme-datasource-http:latest
action-adapter:
build: ./actionAdapter
image: acme-action-adapter:latest
Expand Down
11 changes: 2 additions & 9 deletions acme-cluster/repoMock/conf/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,8 @@ modules = [
"repoMock=com.acme.content.MockRemoteRepositoryVerticle"
]

########### Globals ###########
global {
httpRepo {
port = 3001
}
}

########### Modules configurations ###########
config.repoMock.options.config {
mockDataRoot = mock/repository
httpPort = ${global.httpRepo.port}
mockDataRoot = sample/content
httpPort = 3001
}
69 changes: 69 additions & 0 deletions acme-cluster/repoMock/sample/content/login/step1.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<!--
Copyright (C) 2018 Knot.x Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="http://cognifide.com/favicon.ico?v=2"/>
<title>Knot.x - Login Step 1</title>
<link href="https://bootswatch.com/4/simplex/bootstrap.min.css" rel="stylesheet"/>
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<div class="jumbotron">
<h1>
Sample multi-step form wizard
</h1>
<h2>
Login Form - STEP 1
</h2>
<p>
<a class="btn btn-primary btn-large"
href="https://github.com/Cognifide/knotx">Learn more</a>
</p>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<script data-knotx-knots="form-1,handlebars"
type="text/knotx-snippet">
{{#if action._result.validationErrors}}
<p class="bg-danger">Email address does not exists</p>
{{/if}}
<p>Please provide your email address</p>
<form data-knotx-action="step1" data-knotx-on-success="/content/login/step2.html" data-knotx-on-error="_self" method="post">
<input type="email" name="email" value="{{#if action._result.validationError}} {{action._result.form.email}} {{/if}}" />
<input type="submit" value="Submit"/>
</form>
</script>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-2.2.4.min.js"
integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44="
crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"
integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
crossorigin="anonymous"></script>
</body>
</html>
Loading

0 comments on commit 1db2bf7

Please sign in to comment.