Change min address size to allow '1.1.1.1' address

mgaffney/static-hosts
Michael Gaffney 6 years ago
parent 2a9800a849
commit 8ba06fb099
No known key found for this signature in database
GPG Key ID: 21FE4844A1193A56

@ -571,7 +571,7 @@ begin;
description text,
address text not null
check(
length(trim(address)) > 7
length(trim(address)) > 6
and
length(trim(address)) < 256
),

@ -40,7 +40,7 @@ begin;
description text,
address text not null
check(
length(trim(address)) > 7
length(trim(address)) > 6
and
length(trim(address)) < 256
),

@ -275,7 +275,7 @@ func (r *Repository) CreateHost(ctx context.Context, h *Host, opt ...Option) (*H
// h must contain a valid PublicId. Only h.Name, h.Description, and
// h.Address can be updated. If h.Name is set to a non-empty string, it
// must be unique within h.StaticHostCatalogId. h.Address must contain a
// string where 7 < len(h.Address) < 256.
// string where 6 < len(h.Address) < 256.
//
// An attribute of h will be set to NULL in the database if the attribute
// in h is the zero value and it is included in fieldMask.

@ -192,12 +192,12 @@ func TestHost_New(t *testing.T) {
name: "address-to-short",
args: args{
catalogId: cat.GetPublicId(),
address: "1234567",
address: "123456",
},
want: &Host{
Host: &store.Host{
StaticHostCatalogId: cat.GetPublicId(),
Address: "1234567",
Address: "123456",
},
},
wantWriteErr: true,
@ -206,12 +206,12 @@ func TestHost_New(t *testing.T) {
name: "minimum-address",
args: args{
catalogId: cat.GetPublicId(),
address: "12345678",
address: "1234567",
},
want: &Host{
Host: &store.Host{
StaticHostCatalogId: cat.GetPublicId(),
Address: "12345678",
Address: "1234567",
},
},
},

@ -154,7 +154,7 @@ type Host struct {
// @inject_tag: gorm:"not_null"
StaticHostCatalogId string `protobuf:"bytes,6,opt,name=static_host_catalog_id,json=staticHostCatalogId,proto3" json:"static_host_catalog_id,omitempty" gorm:"not_null"`
// address is the IP Address or DNS name of the host. It must be set and
// it must be 7 < len(address) < 256.
// it must be 6 < len(address) < 256.
// @inject_tag: gorm:"not_null"
Address string `protobuf:"bytes,7,opt,name=address,proto3" json:"address,omitempty" gorm:"not_null"`
}

@ -61,7 +61,7 @@ message Host {
string static_host_catalog_id = 6;
// address is the IP Address or DNS name of the host. It must be set and
// it must be 7 < len(address) < 256.
// it must be 6 < len(address) < 256.
// @inject_tag: gorm:"not_null"
string address = 7;
}

Loading…
Cancel
Save