mirror of
https://github.com/onsonr/sonr.git
synced 2025-03-10 21:09:11 +00:00
* fix: correct HTTP error handling in gateway * refactor: migrate database and ORM to internal modules * feat: introduce taskfile build system for improved workflow management * refactor: update taskfiles to use relative paths * feat: add profile status field * refactor: move rendering logic to context package * fix: improve error handling in credentials retrieval * refactor: optimize HTTP request handling in Wasm environment * refactor: refactor config loading in motr command * chore: add process-compose for service management * chore: remove default task and update gum format command * fix: update project dependencies * refactor: improve code readability and maintainability * refactor: consolidate error handling components * refactor: update index handler to use new context package * refactor: consolidate database scripts and move to deploy directory * feat: Update flake.nix with development tools and environment configuration * fix: ignore flake.lock file * refactor: migrate build process to use taskfiles for improved modularity and maintainability * refactor: improve GatewayContext and reorganize handlers * refactor: Remove unused profile creation functions * (chore): templ generation * test: add test file for vaults.go * maintenance: remove defunct Discord server link * docs: update checks workflow documentation * test: remove obsolete vaults test file * refactor: move version bumping logic to release workflow
49 lines
1.3 KiB
Go
49 lines
1.3 KiB
Go
package embed
|
|
|
|
import (
|
|
"encoding/json"
|
|
|
|
"github.com/ipfs/boxo/files"
|
|
"github.com/onsonr/sonr/internal/config/motr"
|
|
)
|
|
|
|
const SchemaVersion = 1
|
|
const (
|
|
AppManifestFileName = "app.webmanifest"
|
|
DWNConfigFileName = "dwn.json"
|
|
IndexHTMLFileName = "index.html"
|
|
MainJSFileName = "main.js"
|
|
ServiceWorkerFileName = "sw.js"
|
|
)
|
|
|
|
// spawnVaultDirectory creates a new directory with the default files
|
|
func NewVaultFS(cfg *motr.Config) (files.Directory, error) {
|
|
manifestBz, err := NewWebManifest()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
cnfBz, err := json.Marshal(cfg)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return files.NewMapDirectory(map[string]files.Node{
|
|
AppManifestFileName: files.NewBytesFile(manifestBz),
|
|
DWNConfigFileName: files.NewBytesFile(cnfBz),
|
|
IndexHTMLFileName: files.NewBytesFile(IndexHTML),
|
|
MainJSFileName: files.NewBytesFile(MainJS),
|
|
ServiceWorkerFileName: files.NewBytesFile(WorkerJS),
|
|
}), nil
|
|
}
|
|
|
|
// NewVaultConfig returns the default vault config
|
|
func NewVaultConfig(addr string, ucanCID string) *motr.Config {
|
|
return &motr.Config{
|
|
MotrToken: ucanCID,
|
|
MotrAddress: addr,
|
|
IpfsGatewayUrl: "http://localhost:80",
|
|
SonrApiUrl: "http://localhost:1317",
|
|
SonrRpcUrl: "http://localhost:26657",
|
|
SonrChainId: "sonr-testnet-1",
|
|
}
|
|
}
|