zitadel/internal/domain/instance_domain.go
Fabi c25d853820
feat: Instance domains (#3444)
* feat: add domain list

* feat: domain tests

* feat: add redirect url on adding instance domain

* Update internal/command/instance_domain.go

Co-authored-by: Livio Amstutz <livio.a@gmail.com>

* feat: remove unused code

* fix

Co-authored-by: Livio Amstutz <livio.a@gmail.com>
2022-04-14 12:19:18 +00:00

28 lines
565 B
Go

package domain
import (
"strings"
)
type InstanceDomainState int32
const (
InstanceDomainStateUnspecified InstanceDomainState = iota
InstanceDomainStateActive
InstanceDomainStateRemoved
instanceDomainStateCount
)
func (f InstanceDomainState) Valid() bool {
return f >= 0 && f < instanceDomainStateCount
}
func (f InstanceDomainState) Exists() bool {
return f == InstanceDomainStateActive
}
func NewGeneratedInstanceDomain(instanceName, iamDomain string) string {
return strings.ToLower(strings.ReplaceAll(instanceName, " ", "-") + "." + iamDomain)
}