@@ -1194,7 +1194,6 @@ func (s *SqlStore) getAccount(ctx context.Context, accountID string) (*types.Acc
11941194 settings_extra_integrated_validator, settings_extra_integrated_validator_groups
11951195 FROM accounts WHERE id = $1`
11961196
1197- var networkNet , dnsSettingsDisabledGroups []byte
11981197 var (
11991198 sPeerLoginExpirationEnabled sql.NullBool
12001199 sPeerLoginExpiration sql.NullInt64
@@ -1204,20 +1203,24 @@ func (s *SqlStore) getAccount(ctx context.Context, accountID string) (*types.Acc
12041203 sGroupsPropagationEnabled sql.NullBool
12051204 sJWTGroupsEnabled sql.NullBool
12061205 sJWTGroupsClaimName sql.NullString
1207- sJWTAllowGroups [] byte
1206+ sJWTAllowGroups sql. NullString
12081207 sRoutingPeerDNSResolutionEnabled sql.NullBool
12091208 sDNSDomain sql.NullString
1210- sNetworkRange [] byte
1209+ sNetworkRange sql. NullString
12111210 sLazyConnectionEnabled sql.NullBool
12121211 sExtraPeerApprovalEnabled sql.NullBool
12131212 sExtraUserApprovalRequired sql.NullBool
12141213 sExtraIntegratedValidator sql.NullString
1215- sExtraIntegratedValidatorGroups []byte
1214+ sExtraIntegratedValidatorGroups sql.NullString
1215+ networkNet sql.NullString
1216+ dnsSettingsDisabledGroups sql.NullString
1217+ networkIdentifier sql.NullString
1218+ networkDns sql.NullString
1219+ networkSerial sql.NullInt64
12161220 )
1217-
12181221 err := s .pool .QueryRow (ctx , accountQuery , accountID ).Scan (
12191222 & account .Id , & account .CreatedBy , & account .CreatedAt , & account .Domain , & account .DomainCategory , & account .IsDomainPrimaryAccount ,
1220- & account . Network . Identifier , & networkNet , & account . Network . Dns , & account . Network . Serial ,
1223+ & networkIdentifier , & networkNet , & networkDns , & networkSerial ,
12211224 & dnsSettingsDisabledGroups ,
12221225 & sPeerLoginExpirationEnabled , & sPeerLoginExpiration ,
12231226 & sPeerInactivityExpirationEnabled , & sPeerInactivityExpiration ,
@@ -1235,10 +1238,22 @@ func (s *SqlStore) getAccount(ctx context.Context, accountID string) (*types.Acc
12351238 return nil , status .NewGetAccountFromStoreError (err )
12361239 }
12371240
1238- _ = json .Unmarshal (networkNet , & account .Network .Net )
1239- _ = json .Unmarshal (dnsSettingsDisabledGroups , & account .DNSSettings .DisabledManagementGroups )
1240-
12411241 account .Settings = & types.Settings {Extra : & types.ExtraSettings {}}
1242+ if networkNet .Valid {
1243+ _ = json .Unmarshal ([]byte (networkNet .String ), & account .Network .Net )
1244+ }
1245+ if dnsSettingsDisabledGroups .Valid {
1246+ _ = json .Unmarshal ([]byte (dnsSettingsDisabledGroups .String ), & account .DNSSettings .DisabledManagementGroups )
1247+ }
1248+ if networkIdentifier .Valid {
1249+ account .Network .Identifier = networkIdentifier .String
1250+ }
1251+ if networkDns .Valid {
1252+ account .Network .Dns = networkDns .String
1253+ }
1254+ if networkSerial .Valid {
1255+ account .Network .Serial = uint64 (networkSerial .Int64 )
1256+ }
12421257 if sPeerLoginExpirationEnabled .Valid {
12431258 account .Settings .PeerLoginExpirationEnabled = sPeerLoginExpirationEnabled .Bool
12441259 }
@@ -1272,11 +1287,11 @@ func (s *SqlStore) getAccount(ctx context.Context, accountID string) (*types.Acc
12721287 if sLazyConnectionEnabled .Valid {
12731288 account .Settings .LazyConnectionEnabled = sLazyConnectionEnabled .Bool
12741289 }
1275- if sJWTAllowGroups != nil {
1276- _ = json .Unmarshal (sJWTAllowGroups , & account .Settings .JWTAllowGroups )
1290+ if sJWTAllowGroups . Valid {
1291+ _ = json .Unmarshal ([] byte ( sJWTAllowGroups . String ) , & account .Settings .JWTAllowGroups )
12771292 }
1278- if sNetworkRange != nil {
1279- _ = json .Unmarshal (sNetworkRange , & account .Settings .NetworkRange )
1293+ if sNetworkRange . Valid {
1294+ _ = json .Unmarshal ([] byte ( sNetworkRange . String ) , & account .Settings .NetworkRange )
12801295 }
12811296
12821297 if sExtraPeerApprovalEnabled .Valid {
@@ -1288,8 +1303,8 @@ func (s *SqlStore) getAccount(ctx context.Context, accountID string) (*types.Acc
12881303 if sExtraIntegratedValidator .Valid {
12891304 account .Settings .Extra .IntegratedValidator = sExtraIntegratedValidator .String
12901305 }
1291- if sExtraIntegratedValidatorGroups != nil {
1292- _ = json .Unmarshal (sExtraIntegratedValidatorGroups , & account .Settings .Extra .IntegratedValidatorGroups )
1306+ if sExtraIntegratedValidatorGroups . Valid {
1307+ _ = json .Unmarshal ([] byte ( sExtraIntegratedValidatorGroups . String ) , & account .Settings .Extra .IntegratedValidatorGroups )
12931308 }
12941309 return & account , nil
12951310}
0 commit comments