refactor: move session package to pkg directory

This commit is contained in:
Prad Nukala 2024-12-11 12:07:39 -05:00
parent 0e0a46741f
commit 40f50bf37a
15 changed files with 16 additions and 18 deletions

View File

@ -9,10 +9,10 @@ import (
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
"github.com/onsonr/sonr/crypto/ucan"
"github.com/onsonr/sonr/internal/database/sessions"
"github.com/onsonr/sonr/internal/gateway"
"github.com/onsonr/sonr/internal/gateway/config"
"github.com/onsonr/sonr/pkg/common/ipfs"
"github.com/onsonr/sonr/pkg/database/sessions"
"github.com/onsonr/sonr/pkg/didauth/producer"
"github.com/spf13/cobra"
)

View File

@ -5,8 +5,8 @@ import (
"strings"
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/internal/database/sessions"
"github.com/onsonr/sonr/pkg/common"
"github.com/onsonr/sonr/pkg/database/sessions"
"github.com/segmentio/ksuid"
)

View File

@ -4,8 +4,8 @@ import (
"net/http"
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/internal/database/sessions"
"github.com/onsonr/sonr/internal/gateway/config"
"github.com/onsonr/sonr/pkg/database/sessions"
"gorm.io/gorm"
)

View File

@ -2,7 +2,7 @@ package context
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/internal/database/sessions"
"github.com/onsonr/sonr/pkg/database/sessions"
)
// ╭───────────────────────────────────────────────────────╮

View File

@ -1,5 +1,5 @@
// Code generated from Pkl module `sonr.motr.DWN`. DO NOT EDIT.
package types
package config
type Config struct {
IpfsGatewayUrl string `pkl:"ipfsGatewayUrl" json:"ipfsGatewayUrl,omitempty"`

View File

@ -1,5 +1,5 @@
// Code generated from Pkl module `sonr.motr.DWN`. DO NOT EDIT.
package types
package config
import (
"context"

View File

@ -1,5 +1,5 @@
// Code generated from Pkl module `sonr.motr.DWN`. DO NOT EDIT.
package types
package config
type Environment struct {
IsDevelopment bool `pkl:"isDevelopment" json:"isDevelopment,omitempty"`

View File

@ -1,5 +1,5 @@
// Code generated from Pkl module `sonr.motr.DWN`. DO NOT EDIT.
package types
package config
type Schema struct {
Version int `pkl:"version"`

View File

@ -5,7 +5,6 @@ import (
"github.com/ipfs/boxo/files"
"github.com/onsonr/sonr/internal/vault/embed"
"github.com/onsonr/sonr/internal/vault/types"
)
const SchemaVersion = 1
@ -18,7 +17,7 @@ const (
)
// spawnVaultDirectory creates a new directory with the default files
func NewFS(cfg *types.Config) (files.Directory, error) {
func NewVaultFS(cfg *Config) (files.Directory, error) {
manifestBz, err := newWebManifestBytes()
if err != nil {
return nil, err
@ -36,9 +35,9 @@ func NewFS(cfg *types.Config) (files.Directory, error) {
}), nil
}
// GetVaultConfig returns the default vault config
func GetVaultConfig(addr string, ucanCID string) *types.Config {
return &types.Config{
// NewVaultConfig returns the default vault config
func NewVaultConfig(addr string, ucanCID string) *Config {
return &Config{
MotrToken: ucanCID,
MotrAddress: addr,
IpfsGatewayUrl: "http://localhost:80",

View File

@ -1,5 +1,5 @@
// Code generated from Pkl module `sonr.motr.DWN`. DO NOT EDIT.
package types
package config
import "github.com/apple/pkl-go/pkl"

View File

@ -4,13 +4,12 @@ import (
"reflect"
"strings"
"github.com/onsonr/sonr/internal/vault/types"
"github.com/onsonr/sonr/pkg/common/models"
)
// DefaultSchema returns the default schema
func DefaultSchema() *types.Schema {
return &types.Schema{
func DefaultSchema() *Schema {
return &Schema{
Version: SchemaVersion,
Account: getSchema(&models.Account{}),
Asset: getSchema(&models.Asset{}),

View File

@ -1,4 +1,4 @@
@go.Package { name = "github.com/onsonr/sonr/internal/vault/types" }
@go.Package { name = "github.com/onsonr/sonr/internal/vault/config" }
module sonr.motr.DWN