Files
motr/config/config.go
Prad Nukala 7fdfd5f570 feat/ui (#11)
* ui: improve visual consistency across components

* feat: simplify task execution with consolidated commands

* feat: enable account registration flow

* feat: integrate price tracking functionality

* feat: add metadata components for improved SEO and web crawling

* refactor: improve code organization and consistency

* fix: update login template package names

* refactor: rename and restructure UI components for clarity

* feat: introduce dynamic asset selection for transfer UI

* chore: update dependencies and build process

* feat: Add KVNamespace interface for Cloudflare KV store operations

* refactor: Update JSON operations to use Golang generics with JSON Marshaller interface

* feat: Add json import for KVNamespace generic JSON operations

* refactor: Update PutJSON method to accept any type for JSON marshaling

* refactor: migrate to modular architecture with domain-driven design

* fix: directory structure for component routing

* refactor: partial routes to htmx

* docs: update documentation to reflect UI structure changes

* refactor: relocate build artifacts for cleaner project structure

* feat: integrate Cloudflare cache for improved performance

* build: update import paths for middleware package

* feat: implement core authentication flows

* refactor: rename view handler to index handler for clarity

* feat: introduce devbox for streamlined development environment

* feat: introduce deployment and build scripts

* feat: introduce radar and worker services with build automation

* feat: introduce WASM-based worker and radar services

* feat: migrate to standard go build process

* fix: correct worker script path in wrangler configuration

* feat: enhance service monitoring capabilities

* refactor: migrate to new database and KV store context pattern

* build: streamline worker builds using devbox scripts

* feat: migrate to D1 database bindings for improved data access

* feat: introduce session ID middleware

* perf: optimize WASM build size by stripping debug information

* feat: introduce process-compose for simplified local development

* feat: enable direct wrangler commands and simplify deployment
2025-05-28 12:50:38 -04:00

70 lines
1.7 KiB
Go

//go:build js && wasm
// +build js,wasm
package config
import (
"time"
"github.com/syumai/workers/cloudflare"
)
type Config struct {
Cache CacheSettings `json:"cache"` // Added Cache configuration
Sonr NetworkParams `json:"network"`
DefaultExpiry time.Duration `json:"expiry"`
}
type NetworkParams struct {
SonrChainID string `json:"sonr_chain_id"`
SonrAPIURL string `json:"sonr_api_url"`
SonrRPCURL string `json:"sonr_rpc_url"`
IPFSGateway string `json:"ipfs_gateway"`
}
// CacheSettings defines the configuration for Cloudflare cache
type CacheSettings struct {
Enabled bool `json:"enabled"`
DefaultMaxAge int `json:"default_max_age"`
BypassHeader string `json:"bypass_header"`
BypassValue string `json:"bypass_value"`
CacheableStatusCodes []int `json:"cacheable_status_codes"`
CacheableContentTypes []string `json:"cacheable_content_types"`
}
func Get() Config {
cache := CacheSettings{
Enabled: true,
DefaultMaxAge: 60, // 1 minute by default
BypassHeader: "X-Cache-Bypass",
BypassValue: "true",
CacheableStatusCodes: []int{
200, 301, 302,
},
CacheableContentTypes: []string{
"text/html",
"text/css",
"text/javascript",
"application/javascript",
"application/json",
"image/jpeg",
"image/png",
"image/gif",
"image/webp",
},
}
sonr := NetworkParams{
SonrChainID: cloudflare.Getenv("SONR_CHAIN_ID"),
SonrAPIURL: cloudflare.Getenv("SONR_API_URL"),
SonrRPCURL: cloudflare.Getenv("SONR_RPC_URL"),
IPFSGateway: cloudflare.Getenv("IPFS_GATEWAY"),
}
c := Config{
Sonr: sonr,
Cache: cache,
DefaultExpiry: time.Hour * 1,
}
return c
}