* stash

* replace chats sql with store

* strip unused method
This commit is contained in:
Asim Aslam
2021-05-07 17:09:51 +01:00
committed by GitHub
parent 0ad35b9340
commit 542c105037
15 changed files with 410 additions and 315 deletions

View File

@@ -19,10 +19,22 @@ func FromContext(ctx context.Context) (string, bool) {
// FromAccount returns a tenant from
func FromAccount(acc *auth.Account) string {
id := acc.ID
issuer := acc.Issuer
owner := acc.Metadata["apikey_owner"]
if len(owner) == 0 {
owner = acc.ID
if len(id) == 0 {
id = "micro"
}
if len(issuer) == 0 {
issuer = "micro"
}
if len(owner) == 0 {
owner = id
}
return fmt.Sprintf("%s/%s", acc.Issuer, owner)
}