Commit 4d77f96f authored by Peter Grlica's avatar Peter Grlica
Browse files

Some PR changes

parent 0db26041
......@@ -96,6 +96,9 @@ FEDERATION_LABEL=Federation host 1
# Sync settings - paging and sync delay
FEDERATION_SYNC_STRUCTURE_MONITOR_INTERVAL=2m
FEDERATION_SYNC_STRUCTURE_PAGE_SIZE=100
FEDERATION_SYNC_DATA_MONITOR_INTERVAL=60s
FEDERATION_SYNC_DATA_PAGE_SIZE=100
# This needs to be one per page for architectural reasons for now
FEDERATION_SYNC_STRUCTURE_PAGE_SIZE=1
version: "3"
services:
pg:
image: postgres:12.4
environment:
- POSTGRES_PASSWORD=docker
- POSTGRES_USER=docker
ports:
- 5432:5432
volumes:
- ./data/pg:/var/lib/postgresql/data
db:
image: percona:8.0
restart: on-failure
environment:
# To be picked up by percona image when creating the database
# Must match with DB_DSN settings inside .env
MYSQL_DATABASE: corteza
MYSQL_USER: corteza
MYSQL_PASSWORD: rootcorteza
MYSQL_ROOT_PASSWORD: rootcorteza
volumes: [ "./data/db:/var/lib/mysql" ] # use local fs
ports:
- 3306:3306
......@@ -20,87 +20,3 @@ $ docker-compose -f federation/etc/docker-compose.yml up -d node_origin
$ docker-compose -f federation/etc/docker-compose.yml up -d node_destination
----
== Setup db (postgres)
Add db dsn to .env
[source,bash]
----
DB_DSN=postgres+debug://docker:docker@localhost:5432/corteza?sslmode=disable
----
Start the postgres db
[source,bash]
----
$ docker-compose up -db pg
----
== Status
=== Node pairing
=== Structure sync
.TODO
* [ ] Finish endpoints below
* [ ] Add structure sync service (the syncing process)
* [ ] Handle acl
.List of endpoints
* [x] Show exposed module
* [x] Remove exposed module
* [x] Shared module details
* [x] List of shared/exposed modules
* [ ] Add module as exposed - same as add module to federation
* [ ] Add mappings to module
* [ ] Show module mappings
* [ ] Update fields on exposed module
Show exposed module::
[source,bash]
----
$ curl -X GET "$BASE_URL/federation/nodes/$NODE_ID/modules/$MODULE_ID/exposed"
----
Remove exposed module::
[source,bash]
----
$ curl -X DELETE "$BASE_URL/federation/nodes/$NODE_ID/modules/$MODULE_ID/exposed"
----
Shared module details::
[source,bash]
----
$ curl -X GET "$BASE_URL/federation/nodes/$NODE_ID/modules/$MODULE_ID/shared"
----
List of shared/exposed modules::
[source,bash]
----
$ curl -X GET "$BASE_URL/federation/nodes/$NODE_ID/modules?exposed=1"
$ curl -X GET "$BASE_URL/federation/nodes/$NODE_ID/modules?shared=1"
----
Add module as exposed - same as add module to federation::
[source,bash]
----
curl -X PUT "$BASE_URL/federation/nodes/$NODE_ID/modules"
----
Add mappings to module::
[source,bash]
----
curl -X PUT "$BASE_URL/federation/nodes/$NODE_ID/modules/$MODULE_ID/mapped"
----
Show module mappings::
[source,bash]
----
curl -X GET "$BASE_URL/federation/nodes/$NODE_ID/modules/$MODULE_ID/mapped"
----
Update fields on exposed module::
[source,bash]
----
curl -X PUT "$BASE_URL/federation/nodes/$NODE_ID/modules/$MODULE_ID/exposed"
----
......@@ -2,14 +2,16 @@ package rest
import (
"net/http"
"github.com/cortezaproject/corteza-server/federation/service"
)
func middlewareAllowedAccess(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
//if !service.DefaultAccessControl.CanAccess(r.Context()) {
// http.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden)
// return
//}
if !service.DefaultAccessControl.CanAccess(r.Context()) {
http.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden)
return
}
next.ServeHTTP(w, r)
})
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment