Docker template generator
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

model.go 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. package model
  2. import (
  3. "github.com/xenolf/lego/certcrypto"
  4. "time"
  5. )
  6. // CertActions define what will be done with a certificate
  7. type CertActions uint8
  8. // constants defining CertActions
  9. const (
  10. // COMBINE the full chain and private key into one file
  11. COMBINE CertActions = 1 << iota
  12. // FLATTEN the directory structure so all files are in one dir
  13. FLATTEN
  14. // CHMOD the files so they are world readable (potentially dangerous!)
  15. CHMOD
  16. )
  17. // Container models a docker container that is running on the system.
  18. type Container struct {
  19. Id string
  20. Name string
  21. Labels map[string]string
  22. }
  23. // LabelConfig describes the labels used for various properties.
  24. type LabelConfig struct {
  25. Hostnames string
  26. RequireAuth string
  27. }
  28. // AcmeConfig describes the configuration to use for getting certs using ACME.
  29. type AcmeConfig struct {
  30. Email string
  31. DnsProvider string
  32. Endpoint string
  33. KeyType certcrypto.KeyType
  34. CacheLocation string
  35. }
  36. // Hostname describes a DNS name used for proxying, retrieving certificates, etc.
  37. type Hostname struct {
  38. Name string
  39. Alternatives map[string]bool
  40. Containers []*Container
  41. CertActions CertActions
  42. CertDestination string
  43. RequiresAuth bool
  44. AuthGroup string
  45. }
  46. // Config is the user-definable configuration for Dotege.
  47. type Config struct {
  48. Templates []TemplateConfig
  49. Signals []ContainerSignal
  50. Labels LabelConfig
  51. DefaultCertActions CertActions
  52. DefaultCertDestination string
  53. Acme AcmeConfig
  54. }
  55. // TemplateConfig configures a single template for the generator.
  56. type TemplateConfig struct {
  57. Source string
  58. Destination string
  59. }
  60. // ContainerSignal describes a container that should be sent a signal when the config/certs change.
  61. type ContainerSignal struct {
  62. Name string
  63. Signal string
  64. }
  65. // FoundCertificate describes a certificate we've located on disk.
  66. type FoundCertificate struct {
  67. Hostname string
  68. Cert string
  69. Chain string
  70. FullChain string
  71. PrivateKey string
  72. ModTime time.Time
  73. }