Skip to content

Commit

Permalink
Add prefix to namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
neekolas committed Dec 2, 2024
1 parent a50c51e commit c9e9bcf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pkg/db/pgx.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ func isValidNamespace(namespace string) error {
// PostgreSQL identifiers must start with a letter or underscore
if !allowedNamespaceRe.MatchString(namespace) {
return fmt.Errorf(
"namespace must start with a letter or underscore and contain only letters, numbers, and underscores",
"namespace must start with a letter or underscore and contain only letters, numbers, and underscores. Instead is %s",
namespace,
)
}
return nil
Expand Down
4 changes: 3 additions & 1 deletion pkg/utils/namespace.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package utils

import (
"fmt"

ethcrypto "github.com/ethereum/go-ethereum/crypto"
"github.com/xmtp/xmtpd/pkg/config"
)
Expand All @@ -11,5 +13,5 @@ func BuildNamespace(options config.ServerOptions) string {
[]byte(options.Contracts.NodesContractAddress),
)

return HexEncode(hash)[:12]
return fmt.Sprintf("xmtpd-%s", HexEncode(hash)[:12])
}

0 comments on commit c9e9bcf

Please sign in to comment.