@@ -47,6 +47,7 @@ func configureEnv(cfg Config, envDir string) error {
4747 generateScubaConfig ,
4848 generateS3MetadataConfig ,
4949 generateScubaMetadataConfig ,
50+ generateKafkaConfig ,
5051 }
5152
5253 configDir := filepath .Join (envDir , "config" )
@@ -75,61 +76,34 @@ func generateCloudserverConfig(cfg Config, path string) error {
7576
7677func generateBackbeatConfig (cfg Config , path string ) error {
7778 templates := []string {
78- "Dockerfile.setup" ,
79- "setup.sh" ,
80- "setup-kafka-target.sh" ,
81- "config.notification.json" ,
82- "config.json" ,
83- "supervisord.conf" ,
8479 "env" ,
80+ "supervisord.conf" ,
81+ "config.json" ,
82+ "config.notification.json" ,
83+ "notificationCredentials.json" ,
8584 }
8685
87- for _ , tmpl := range templates {
88- templatePath := filepath .Join ("templates" , "backbeat" , tmpl )
89- outputPath := filepath .Join (path , "backbeat" , tmpl )
90- if err := renderTemplateToFile (getTemplates (), templatePath , cfg , outputPath ); err != nil {
91- return fmt .Errorf ("failed to render template %s: %w" , tmpl , err )
92- }
93- }
94- return nil
86+ return renderTemplates (cfg , "templates/backbeat" , filepath .Join (path , "backbeat" ), templates )
9587}
9688
9789func generateVaultConfig (cfg Config , path string ) error {
98- err := renderTemplateToFile (getTemplates (), "templates/vault/config.json" , cfg , filepath .Join (path , "vault" , "config.json" ))
99- if err != nil {
100- return err
101- }
102-
103- err = renderTemplateToFile (getTemplates (), "templates/vault/create-management-account.sh" , cfg , filepath .Join (path , "vault" , "create-management-account.sh" ))
104- if err != nil {
105- return err
106- }
107-
108- err = renderTemplateToFile (getTemplates (), "templates/vault/Dockerfile.setup" , cfg , filepath .Join (path , "vault" , "Dockerfile.setup" ))
109- if err != nil {
110- return err
111- }
112-
113- err = renderTemplateToFile (getTemplates (), "templates/vault/management-creds.json" , cfg , filepath .Join (path , "vault" , "management-creds.json" ))
114- if err != nil {
115- return err
90+ templates := []string {
91+ "config.json" ,
92+ "create-management-account.sh" ,
93+ "Dockerfile.setup" ,
94+ "management-creds.json" ,
11695 }
11796
118- return nil
97+ return renderTemplates ( cfg , "templates/vault" , filepath . Join ( path , "vault" ), templates )
11998}
12099
121100func generateScubaConfig (cfg Config , path string ) error {
122- err := renderTemplateToFile (getTemplates (), "templates/scuba/create-service-user.sh" , cfg , filepath .Join (path , "scuba" , "create-service-user.sh" ))
123- if err != nil {
124- return err
125- }
126-
127- err = renderTemplateToFile (getTemplates (), "templates/scuba/Dockerfile.setup" , cfg , filepath .Join (path , "scuba" , "Dockerfile.setup" ))
128- if err != nil {
129- return err
101+ templates := []string {
102+ "config.json" ,
103+ "create-service-user.sh" ,
104+ "Dockerfile.setup" ,
130105 }
131-
132- return renderTemplateToFile (getTemplates (), "templates/scuba/config.json" , cfg , filepath .Join (path , "scuba" , "config.json" ))
106+ return renderTemplates (cfg , "templates/scuba" , filepath .Join (path , "scuba" ), templates )
133107}
134108
135109func generateMetadataConfig (cfg MetadataConfig , path string ) error {
@@ -145,3 +119,16 @@ func generateScubaMetadataConfig(cfg Config, path string) error {
145119 cfgPath := filepath .Join (path , "metadata-scuba" )
146120 return generateMetadataConfig (cfg .ScubaMetadata , cfgPath )
147121}
122+
123+ func generateKafkaConfig (cfg Config , path string ) error {
124+ templates := []string {
125+ "Dockerfile" ,
126+ "setup.sh" ,
127+ "server.backbeat.properties" ,
128+ "server.destination.properties" ,
129+ "config.properties" ,
130+ "zookeeper.properties" ,
131+ }
132+
133+ return renderTemplates (cfg , "templates/kafka" , filepath .Join (path , "kafka" ), templates )
134+ }
0 commit comments