Skip to content

Commit

Permalink
Removed config for invite_link
Browse files Browse the repository at this point in the history
The link template is still defined in a constant but not
exposed in the config, as it depends on Mentix and should not be
changed.
  • Loading branch information
glpatcern committed May 19, 2023
1 parent 2be8a61 commit 754fb1f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
9 changes: 1 addition & 8 deletions internal/http/services/sciencemesh/email.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,7 @@ func (h *tokenHandler) initSubjectTemplate(subjTempl string) error {
}

func (h *tokenHandler) initInviteLinkTemplate(inviteTempl string) error {
var t string
if inviteTempl == "" {
t = defaultInviteLink
} else {
t = inviteTempl
}

tpl, err := template.New("tpl_invite").Parse(t)
tpl, err := template.New("tpl_invite").Parse(inviteTempl)
if err != nil {
return err
}
Expand Down
1 change: 0 additions & 1 deletion internal/http/services/sciencemesh/sciencemesh.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ type config struct {
SubjectTemplate string `mapstructure:"subject_template"`
BodyTemplatePath string `mapstructure:"body_template_path"`
OCMMountPoint string `mapstructure:"ocm_mount_point"`
InviteLinkTemplate string `mapstructure:"invite_link_template"`
}

func (c *config) init() {
Expand Down
7 changes: 5 additions & 2 deletions internal/http/services/sciencemesh/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import (
"github.com/cs3org/reva/pkg/smtpclient"
)

const defaultInviteLink = "{{.MeshDirectoryURL}}?token={{.Token}}&providerDomain={{.User.Id.Idp}}"
const defaultInviteLinkPrefix = "{{.MeshDirectoryURL}}?token={{.Token}}&providerDomain="

type tokenHandler struct {
gatewayClient gateway.GatewayAPIClient
Expand Down Expand Up @@ -71,7 +71,10 @@ func (h *tokenHandler) init(c *config) error {
return err
}

return h.initInviteLinkTemplate(c.InviteLinkTemplate)
if c.ProviderDomain == "" {
return errors.New("provider_domain missing from configuration")
}
return h.initInviteLinkTemplate(defaultInviteLinkPrefix + c.ProviderDomain)
}

type token struct {
Expand Down

0 comments on commit 754fb1f

Please sign in to comment.