map.go 548 B

1234567891011121314151617181920212223242526
  1. /**
  2. * The ephemeralvariablemap is used "only" for variable substitution in config
  3. * titles, shell arguments, etc, in the foorm of {{ key }}, like Jinja2.
  4. *
  5. * OliveTin itself really only ever "writes" to this map, mostly by loading
  6. * EntityFiles, and the only form of "reading" is for the variable substitution
  7. * in configs.
  8. */
  9. package stringvariables
  10. var Contents map[string]string
  11. func init() {
  12. Contents = make(map[string]string)
  13. }
  14. func Get(key string) string {
  15. v, ok := Contents[key]
  16. if !ok {
  17. return ""
  18. } else {
  19. return v
  20. }
  21. }