in internal/pkg/core/deployers/deployers.go [74:113]
func (d *Deployer) Deploy(ctx context.Context) error {
files, err := os.ReadDir(d.basePath)
if err != nil {
return err
}
if len(files) == 0 {
return nil
}
for _, artifactType := range []string{"Sequences", "APIs", "Inbounds"} {
folderPath := filepath.Join(d.basePath, artifactType)
files, err := os.ReadDir(folderPath)
if err != nil {
return err
}
for _, file := range files {
if file.IsDir() || filepath.Ext(file.Name()) != ".xml" {
continue
}
xmlFile, err := os.Open(filepath.Join(folderPath, file.Name()))
if err != nil {
return err
}
defer xmlFile.Close()
data, err := io.ReadAll(xmlFile)
if err != nil {
d.logger.Error("Error reading file:", "error", err)
continue
}
switch artifactType {
case "APIs":
d.DeployAPIs(ctx, file.Name(), string(data))
case "Sequences":
d.DeploySequences(ctx, file.Name(), string(data))
case "Inbounds":
d.DeployInbounds(ctx, file.Name(), string(data))
}
}
}
return nil
}