package settings

import "sync"

type Runtime struct {
	mu      sync.RWMutex
	current Settings
}

func NewRuntime(initial Settings) *Runtime {
	return &Runtime{current: initial}
}

func (r *Runtime) Get() Settings {
	r.mu.RLock()
	defer r.mu.RUnlock()
	return r.current
}

func (r *Runtime) Update(next Settings) {
	r.mu.Lock()
	r.current = next
	r.mu.Unlock()
}
