@@ -21,6 +21,7 @@ import (
21
21
22
22
const RestServerPath = "/pkg/rest/server"
23
23
const RestClientPath = "/pkg/rest/client"
24
+ const ConfigPath = "/config"
24
25
25
26
const ControllersPath = RestServerPath + "/controllers"
26
27
const ServicesPath = RestServerPath + "/services"
@@ -53,6 +54,7 @@ const MySQLGORMDBConfigFile = "mysql-gorm.go.tmpl"
53
54
const SQLiteGORMDBConfigFile = "sqlite-gorm.go.tmpl"
54
55
55
56
const ClientFile = "client.go.tmpl"
57
+ const ConfigFile = "rest-opentel-config.go.tmpl"
56
58
57
59
// MongoDB nosql databases
58
60
const MongoDB = "MongoDB"
@@ -155,10 +157,15 @@ func (c *Copier) createRestClientDirectories() error {
155
157
156
158
// createRestServerDirectories creates rest server directories.
157
159
func (c * Copier ) createRestServerDirectories () error {
160
+ configDirectory := c .NodeDirectoryName + ConfigPath
158
161
controllersDirectory := c .NodeDirectoryName + ControllersPath
159
162
modelsDirectory := c .NodeDirectoryName + ModelsPath
160
163
servicesDirectory := c .NodeDirectoryName + ServicesPath
161
164
daosDirectory := c .NodeDirectoryName + DaosPath
165
+ if err := utils .CreateDirectories (configDirectory ); err != nil {
166
+ log .Debugf ("error creating config directory: %v" , err )
167
+ return err
168
+ }
162
169
if err := utils .CreateDirectories (controllersDirectory ); err != nil {
163
170
log .Debugf ("error creating controllers directory: %v" , err )
164
171
return err
@@ -624,6 +631,22 @@ func (c *Copier) CreateRestServer() error {
624
631
return err
625
632
}
626
633
}
634
+ // copy opentel config file
635
+ var filePaths []string
636
+ // client files
637
+ targetOpenTelConfigFileName := c .NodeDirectoryName + ConfigPath + "/" + ConfigFile
638
+ _ , err := utils .CopyFile (targetOpenTelConfigFileName , c .TemplatesRootPath + ConfigPath + "/" + ConfigFile )
639
+ if err != nil {
640
+ log .Debugf ("error copying opentel config file: %v" , err )
641
+ return err
642
+ }
643
+ filePaths = append (filePaths , targetOpenTelConfigFileName )
644
+ err = executor .Execute (filePaths , c .Data )
645
+ if err != nil {
646
+ log .Debugf ("error executing opentel config file: %v" , err )
647
+ return err
648
+ }
649
+
627
650
if c .IsSQLDB {
628
651
// create sql db config file (common to all resources for specific database)
629
652
// No vars in config file as of now but in future they may be there.
0 commit comments