Skip to content

Commit

Permalink
hub documentation
Browse files Browse the repository at this point in the history
Signed-off-by: jkoberg <[email protected]>
  • Loading branch information
kobergj committed Apr 3, 2023
1 parent b30472e commit c5081e9
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 11 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ OCIS_MODULES = \
services/gateway \
services/graph \
services/groups \
services/hub \
services/idm \
services/idp \
services/invitations \
Expand Down
4 changes: 2 additions & 2 deletions docs/helpers/configenvextractor.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ func runIntermediateCode(intermediateCodePath string) {
defaultPath := "~/.ocis"
os.Setenv("OCIS_BASE_DATA_PATH", defaultPath)
os.Setenv("OCIS_CONFIG_DIR", path.Join(defaultPath, "config"))
out, err := exec.Command("go", "run", intermediateCodePath).Output()
out, err := exec.Command("go", "run", intermediateCodePath).CombinedOutput()
if err != nil {
log.Fatal(err)
log.Fatal(err, string(out))
}
fmt.Println(string(out))
}
37 changes: 37 additions & 0 deletions services/hub/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
SHELL := bash
NAME := hub

include ../../.make/recursion.mk

############ tooling ############
ifneq (, $(shell command -v go 2> /dev/null)) # suppress `command not found warnings` for non go targets in CI
include ../../.bingo/Variables.mk
endif

############ go tooling ############
include ../../.make/go.mk

############ release ############
include ../../.make/release.mk

############ docs generate ############
include ../../.make/docs.mk

.PHONY: docs-generate
docs-generate: config-docs-generate

############ generate ############
include ../../.make/generate.mk

.PHONY: ci-go-generate
ci-go-generate: # CI runs ci-node-generate automatically before this target

.PHONY: ci-node-generate
ci-node-generate:

############ licenses ############
.PHONY: ci-node-check-licenses
ci-node-check-licenses:

.PHONY: ci-node-save-licenses
ci-node-save-licenses:
12 changes: 12 additions & 0 deletions services/hub/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Hub Service

The hub service provides `server sent events` (`sse`) functionality to clients

## Subscribing

A client can use the `hub/sse` endpoint to subscribe to events. This will open a http(s) connection for the server to send events to subscribed clients. These events can inform clients about various changes on the server like: file uploads, shares, space memberships, etc.

## Available Events
For a complete and up-to-date list of available events see `/services/hub/pkg/service/events.go`.

Note that for the time being, the `hub` service only serves the `UploadReady` event which is emitted when postprocessing a file has finished and the file is available for user access.
12 changes: 6 additions & 6 deletions services/hub/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type Config struct {
Events Events `yaml:"events"`
Reva *shared.Reva `yaml:"reva"`

MachineAuthAPIKey string `yaml:"machine_auth_api_key" env:"OCIS_MACHINE_AUTH_API_KEY;SEARCH_MACHINE_AUTH_API_KEY" desc:"Machine auth API key used to validate internal requests necessary for the access to resources from other services."`
MachineAuthAPIKey string `yaml:"machine_auth_api_key" env:"OCIS_MACHINE_AUTH_API_KEY;HUB_MACHINE_AUTH_API_KEY" desc:"Machine auth API key used to validate internal requests necessary for the access to resources from other services."`
}

// Service defines the available service configuration.
Expand All @@ -38,9 +38,9 @@ type TokenManager struct {

// Events combines the configuration options for the event bus.
type Events struct {
Endpoint string `yaml:"endpoint" env:"NOTIFICATIONS_EVENTS_ENDPOINT" desc:"The address of the event system. The event system is the message queuing service. It is used as message broker for the microservice architecture."`
Cluster string `yaml:"cluster" env:"NOTIFICATIONS_EVENTS_CLUSTER" desc:"The clusterID of the event system. The event system is the message queuing service. It is used as message broker for the microservice architecture. Mandatory when using NATS as event system."`
TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_INSECURE;NOTIFICATIONS_EVENTS_TLS_INSECURE" desc:"Whether to verify the server TLS certificates."`
TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"NOTIFICATIONS_EVENTS_TLS_ROOT_CA_CERTIFICATE" desc:"The root CA certificate used to validate the server's TLS certificate. If provided NOTIFICATIONS_EVENTS_TLS_INSECURE will be seen as false."`
EnableTLS bool `yaml:"enable_tls" env:"OCIS_EVENTS_ENABLE_TLS;NOTIFICATIONS_EVENTS_ENABLE_TLS" desc:"Enable TLS for the connection to the events broker. The events broker is the ocis service which receives and delivers events between the services.."`
Endpoint string `yaml:"endpoint" env:"HUB_EVENTS_ENDPOINT" desc:"The address of the event system. The event system is the message queuing service. It is used as message broker for the microservice architecture."`
Cluster string `yaml:"cluster" env:"HUB_EVENTS_CLUSTER" desc:"The clusterID of the event system. The event system is the message queuing service. It is used as message broker for the microservice architecture. Mandatory when using NATS as event system."`
TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_INSECURE;HUB_EVENTS_TLS_INSECURE" desc:"Whether the server should skip the client certificate verification during the TLS handshake."`
TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"HUB_EVENTS_TLS_ROOT_CA_CERTIFICATE" desc:"The root CA certificate used to validate the server's TLS certificate. If provided HUB_EVENTS_TLS_INSECURE will be seen as false."`
EnableTLS bool `yaml:"enable_tls" env:"OCIS_EVENTS_ENABLE_TLS;HUB_EVENTS_ENABLE_TLS" desc:"Enable TLS for the connection to the events broker. The events broker is the ocis service which receives and delivers events between the services."`
}
8 changes: 8 additions & 0 deletions services/hub/pkg/config/defaults/defaultconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ import (
"github.com/owncloud/ocis/v2/services/hub/pkg/config"
)

// FullDefaultConfig used by doc generation
func FullDefaultConfig() *config.Config {
cfg := DefaultConfig()
EnsureDefaults(cfg)
Sanitize(cfg)
return cfg
}

// DefaultConfig returns the default config
func DefaultConfig() *config.Config {
return &config.Config{
Expand Down
6 changes: 3 additions & 3 deletions services/proxy/pkg/config/defaults/defaultconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ import (
"github.com/owncloud/ocis/v2/services/proxy/pkg/config"
)

// FullDefaultConfig returns a fully initialized default configuration
// FullDefaultConfig used by docs generation
func FullDefaultConfig() *config.Config {
cfg := DefaultConfig()
EnsureDefaults(cfg)
Sanitize(cfg)
return cfg
}

// DefaultConfig returns a basic default configuration
// DefaultConfig returns the proxys default config
func DefaultConfig() *config.Config {
return &config.Config{
Debug: config.Debug{
Expand Down Expand Up @@ -82,7 +82,7 @@ func DefaultConfig() *config.Config {
}
}

// DefaultPolicies returns the default proxy policies.
// DefaultPolicies returns the default routing policies
func DefaultPolicies() []config.Policy {
return []config.Policy{
{
Expand Down

0 comments on commit c5081e9

Please sign in to comment.