Skip to content

Commit

Permalink
Merge pull request #117 from Threagile/fix-running-program
Browse files Browse the repository at this point in the history
Fix running program
  • Loading branch information
ezavgorodniy authored Nov 18, 2024
2 parents 568b3b5 + d58c2d7 commit 7026c2c
Showing 1 changed file with 6 additions and 72 deletions.
78 changes: 6 additions & 72 deletions internal/threagile/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import (
"encoding/json"
"errors"
"fmt"
"gopkg.in/yaml.v3"
"log"
"os"
"path/filepath"
"runtime"
"strings"

"gopkg.in/yaml.v3"

"github.com/threagile/threagile/pkg/report"
"github.com/threagile/threagile/pkg/types"
)
Expand Down Expand Up @@ -64,75 +65,6 @@ type Config struct {
ReportConfigurationValue report.ReportConfiguation `json:"ReportConfiguration" yaml:"ReportConfiguration"`
}

type ConfigGetter interface {
GetBuildTimestamp() string
GetVerbose() bool
GetInteractive() bool
GetAppFolder() string
GetPluginFolder() string
GetDataFolder() string
GetOutputFolder() string
GetServerFolder() string
GetTempFolder() string
GetKeyFolder() string
GetTechnologyFilename() string
GetInputFile() string
GetDataFlowDiagramFilenamePNG() string
GetDataAssetDiagramFilenamePNG() string
GetDataFlowDiagramFilenameDOT() string
GetDataAssetDiagramFilenameDOT() string
GetReportFilename() string
GetExcelRisksFilename() string
GetExcelTagsFilename() string
GetJsonRisksFilename() string
GetJsonTechnicalAssetsFilename() string
GetJsonStatsFilename() string
GetReportLogoImagePath() string
GetTemplateFilename() string
GetRiskRulePlugins() []string
GetSkipRiskRules() []string
GetExecuteModelMacro() string
GetRiskExcelConfigHideColumns() []string
GetRiskExcelConfigSortByColumns() []string
GetRiskExcelConfigWidthOfColumns() map[string]float64
GetRiskExcelWrapText() bool
GetRiskExcelShrinkColumnsToFit() bool
GetRiskExcelColorText() bool
GetServerMode() bool
GetDiagramDPI() int
GetServerPort() int
GetGraphvizDPI() int
GetMinGraphvizDPI() int
GetMaxGraphvizDPI() int
GetBackupHistoryFilesToKeep() int
GetAddModelTitle() bool
GetKeepDiagramSourceFiles() bool
GetIgnoreOrphanedRiskTracking() bool
GetAttractiveness() Attractiveness
GetReportConfiguration() report.ReportConfiguation
GetThreagileVersion() string
GetProgressReporter() types.ProgressReporter
GetReportConfigurationHideChapters() map[report.ChaptersToShowHide]bool
}

type ConfigSetter interface {
SetVerbose(verbose bool)
SetInteractive(interactive bool)
SetAppFolder(appFolder string)
SetPluginFolder(pluginFolder string)
SetOutputFolder(outputFolder string)
SetServerFolder(serverFolder string)
SetTempFolder(tempFolder string)
SetInputFile(inputFile string)
SetTemplateFilename(templateFilename string)
SetRiskRulePlugins(riskRulePlugins []string)
SetSkipRiskRules(skipRiskRules []string)
SetServerMode(serverMode bool)
SetDiagramDPI(diagramDPI int)
SetServerPort(serverPort int)
SetIgnoreOrphanedRiskTracking(ignoreOrphanedRiskTracking bool)
}

func (c *Config) Defaults(buildTimestamp string) *Config {
*c = Config{
BuildTimestampValue: buildTimestamp,
Expand Down Expand Up @@ -280,7 +212,9 @@ func (c *Config) Load(configFilename string) error {
errorList = append(errorList, dataDirError)
}

c.TechnologyFilenameValue = c.CleanPath(c.TechnologyFilenameValue)
if c.TechnologyFilenameValue != "" {
c.TechnologyFilenameValue = c.CleanPath(c.TechnologyFilenameValue)
}

serverFolderError := c.CheckServerFolder()
if serverFolderError != nil {
Expand Down Expand Up @@ -381,7 +315,7 @@ func (c *Config) Merge(config Config, values map[string]any) {
c.TemplateFilenameValue = config.TemplateFilenameValue

case strings.ToLower("ReportLogoImagePath"):
c.TemplateFilenameValue = config.ReportLogoImagePathValue
c.ReportLogoImagePathValue = config.ReportLogoImagePathValue

case strings.ToLower("TechnologyFilename"):
c.TechnologyFilenameValue = config.TechnologyFilenameValue
Expand Down

0 comments on commit 7026c2c

Please sign in to comment.