feat: added wallet service

This commit is contained in:
darwincereska
2025-12-23 17:38:27 -05:00
parent 23f6dba3f3
commit 99c5dba721
9 changed files with 527 additions and 5 deletions

View File

@@ -8,10 +8,15 @@ import (
"ccoin/utils"
)
var version = "dev"
var buildTime = time.Now().Format(time.RFC3339)
var commit = "none"
type ServerConfig struct {
// App details
Version string
BuildTime string
Commit string
BaseURL string
// Server settings
@@ -66,9 +71,10 @@ func NewServerConfig() *ServerConfig {
// Loads configuration from environment variables with defaults
func (c *ServerConfig) loadConfig() {
// App details (these would typically come from build-time variables)
c.Version = utils.GetEnvOrDefault("VERSION", "dev")
c.BuildTime = utils.GetEnvOrDefault("BUILD_TIME", time.Now().Format(time.RFC3339))
c.Version = version
c.BuildTime = utils.GetEnvOrDefault("BUILD_TIME", buildTime)
c.BaseURL = utils.GetEnvOrDefault("BASE_URL", "http://localhost:8080")
c.Commit = commit
// Server settings
c.Host = utils.GetEnvOrDefault("SERVER_HOST", "0.0.0.0")
@@ -109,6 +115,7 @@ func (c *ServerConfig) logConfig() {
c.logger.Info("Server configuration loaded:")
c.logger.Info("Host", "value", c.Host)
c.logger.Info("Port", "value", c.Port)
c.logger.Info("Version", "value", c.Version)
c.logger.Info("Development mode", "value", c.DevelopmentMode)
c.logger.Info("Mining difficulty", "value", c.MiningDifficulty)
c.logger.Info("Mining reward", "value", c.MiningReward)