Skip to content
This repository was archived by the owner on Nov 24, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions traffic_ops/traffic_ops_golang/crconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ import (
"errors"
"strconv"
"strings"

"github.com/apache/trafficcontrol/lib/go-log"
"github.com/apache/trafficcontrol/lib/go-tc"
)

func makeCRConfigConfig(cdn string, tx *sql.Tx, dnssecEnabled bool, domain string) (map[string]interface{}, error) {
Expand Down Expand Up @@ -94,16 +97,18 @@ select name, value from parameter where id in (
select parameter from profile_parameter where profile in (
select distinct profile from server where cdn_id = (
select id from cdn where name = $1
) and type = (
select id from type where name = $2
)
)
)
and config_file = 'CRConfig.json'
`
rows, err := tx.Query(q, cdn)
rows, err := tx.Query(q, cdn, tc.RouterTypeName)
if err != nil {
return nil, errors.New("Error querying router params: " + err.Error())
}
defer rows.Close()
defer log.Close(rows, "closing crconfig parameter rows")

params := []CRConfigConfigParameter{}
for rows.Next() {
Expand Down
3 changes: 2 additions & 1 deletion traffic_ops/traffic_ops_golang/crconfig/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"testing"
"time"

"github.com/apache/trafficcontrol/lib/go-tc"
"github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/test"

"gopkg.in/DATA-DOG/go-sqlmock.v1"
Expand All @@ -46,7 +47,7 @@ func MockGetConfigParams(mock sqlmock.Sqlmock, expected []CRConfigConfigParamete
v := param.Value
rows = rows.AddRow(n, v)
}
mock.ExpectQuery("select").WithArgs(cdn).WillReturnRows(rows)
mock.ExpectQuery("select").WithArgs(cdn, tc.RouterTypeName).WillReturnRows(rows)
}

func TestGetConfigParams(t *testing.T) {
Expand Down