Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
corteza
corteza-server
Commits
4d77f96f
Commit
4d77f96f
authored
4 years ago
by
Peter Grlica
Browse files
Options
Download
Email Patches
Plain Diff
Some PR changes
parent
0db26041
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
113 deletions
+10
-113
.env.example
.env.example
+4
-1
docker-compose.yml
docker-compose.yml
+0
-24
federation/README.adoc
federation/README.adoc
+0
-84
federation/rest/middleware.go
federation/rest/middleware.go
+6
-4
No files found.
.env.example
View file @
4d77f96f
...
...
@@ -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
This diff is collapsed.
Click to expand it.
docker-compose.yml
deleted
100644 → 0
View file @
0db26041
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
This diff is collapsed.
Click to expand it.
federation/README.adoc
View file @
4d77f96f
...
...
@@ -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"
----
This diff is collapsed.
Click to expand it.
federation/rest/middleware.go
View file @
4d77f96f
...
...
@@ -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
)
})
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment