ApplicationProperties.java 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. package seecoder.devcloud.api;
  2. import lombok.Data;
  3. import org.hibernate.validator.constraints.URL;
  4. import org.springframework.boot.context.properties.ConfigurationProperties;
  5. import org.springframework.context.annotation.Configuration;
  6. import org.springframework.validation.annotation.Validated;
  7. import javax.validation.Valid;
  8. import javax.validation.constraints.NotEmpty;
  9. @Data
  10. @Configuration
  11. @ConfigurationProperties("seecoder")
  12. @Validated
  13. public class ApplicationProperties {
  14. @Valid
  15. private Gitlab gitlab = new Gitlab();
  16. @Valid
  17. private Docker docker = new Docker();
  18. // @Valid
  19. // private Mail mail = new Mail();
  20. @Valid
  21. private K8s k8s = new K8s();
  22. @Valid
  23. private Git git = new Git();
  24. @Data
  25. public static class Gitlab {
  26. @NotEmpty
  27. private String host;
  28. /**
  29. * 采用的Personal/project access tokens的认证方式
  30. * 这里使用管理员的token
  31. * https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html
  32. */
  33. @NotEmpty
  34. private String token;
  35. @NotEmpty
  36. private String webhookProxy;
  37. }
  38. @Data
  39. public static class Docker {
  40. private String host;
  41. /**
  42. * 是否开启tls验证
  43. */
  44. private Boolean tls = false;
  45. private String certificatesPath = "docker/";
  46. private String registry;
  47. private String registryUsername;
  48. private String registryPassword;
  49. }
  50. // @Data
  51. // public static class Mail {
  52. // @Email
  53. // @NotEmpty
  54. // private String from;
  55. // @NotEmpty
  56. // private String personal = "MOOCODER";
  57. // }
  58. @Data
  59. public static class K8s{
  60. @URL
  61. @NotEmpty
  62. private String apiServer;
  63. @NotEmpty
  64. private String token;
  65. private Boolean validateSSL = false;
  66. private Boolean debugging = false;
  67. /**
  68. * k8s配置ingress时候的host后缀
  69. */
  70. private String ingressHostSuffix;
  71. }
  72. @Data
  73. public static class Git {
  74. @NotEmpty
  75. private String username;
  76. @NotEmpty
  77. private String password;
  78. }
  79. }