config: add namespace support (#1780)

* config/cmd: use service namespace for config

* config/service: add namespace option to list
This commit is contained in:
ben-toogood 2020-07-02 14:07:58 +01:00 committed by GitHub
parent 3c633e3577
commit d577dd6abe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 45 additions and 31 deletions

View File

@ -831,7 +831,11 @@ func (c *cmd) Before(ctx *cli.Context) error {
// Setup config sources // Setup config sources
if ctx.String("config") == "service" { if ctx.String("config") == "service" {
opt := config.WithSource(configSrv.NewSource(configSrc.WithClient(microClient))) opt := config.WithSource(configSrv.NewSource(
configSrc.WithClient(microClient),
configSrv.Namespace(ctx.String("service_namespace")),
))
if err := (*c.opts.Config).Init(opt); err != nil { if err := (*c.opts.Config).Init(opt); err != nil {
logger.Fatalf("Error configuring config: %v", err) logger.Fatalf("Error configuring config: %v", err)
} }

View File

@ -361,6 +361,7 @@ func (m *DeleteResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_DeleteResponse proto.InternalMessageInfo var xxx_messageInfo_DeleteResponse proto.InternalMessageInfo
type ListRequest struct { type ListRequest struct {
Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_sizecache int32 `json:"-"`
@ -391,6 +392,13 @@ func (m *ListRequest) XXX_DiscardUnknown() {
var xxx_messageInfo_ListRequest proto.InternalMessageInfo var xxx_messageInfo_ListRequest proto.InternalMessageInfo
func (m *ListRequest) GetNamespace() string {
if m != nil {
return m.Namespace
}
return ""
}
type ListResponse struct { type ListResponse struct {
Values []*Change `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"` Values []*Change `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
@ -632,35 +640,35 @@ func init() {
} }
var fileDescriptor_e67338fe1f659d14 = []byte{ var fileDescriptor_e67338fe1f659d14 = []byte{
// 434 bytes of a gzipped FileDescriptorProto // 440 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0xcd, 0x8e, 0xd3, 0x30, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0x4d, 0x6b, 0xdb, 0x40,
0x10, 0xc7, 0x9b, 0xb6, 0x1b, 0xe8, 0xb4, 0x49, 0xd1, 0x1c, 0x50, 0x14, 0x21, 0x51, 0x59, 0x42, 0x10, 0xb5, 0x6c, 0x47, 0xad, 0xc7, 0x96, 0x5c, 0xe6, 0x50, 0x84, 0x28, 0xd4, 0x2c, 0x14, 0xdc,
0x2a, 0x20, 0xb9, 0xab, 0xf2, 0x00, 0x20, 0x95, 0x23, 0xa7, 0x20, 0xb4, 0x67, 0xe3, 0xce, 0x6e, 0x06, 0xd6, 0xc1, 0xfd, 0x01, 0x2d, 0xb8, 0xc7, 0x9e, 0x54, 0x4a, 0xce, 0xdb, 0xf5, 0x24, 0x36,
0x23, 0x36, 0x1f, 0xc4, 0xce, 0xbe, 0xc3, 0xbe, 0x35, 0xf2, 0x47, 0x36, 0x49, 0x0f, 0x95, 0xca, 0x8d, 0x2c, 0x55, 0xbb, 0xca, 0x7f, 0xc8, 0xbf, 0x2e, 0xfb, 0xa1, 0x48, 0x32, 0x45, 0xd4, 0xb9,
0xcd, 0xf3, 0xf5, 0x9f, 0xb1, 0x7f, 0x93, 0xc0, 0x47, 0x59, 0x95, 0xf7, 0xf9, 0xc3, 0x4e, 0x55, 0x69, 0xde, 0xce, 0xbc, 0x37, 0xbb, 0xef, 0xd9, 0xf0, 0x51, 0x16, 0xa7, 0xbb, 0xe3, 0xfd, 0x46,
0x6d, 0x23, 0x69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, 0x18, 0xf3, 0x11, 0xfe, 0x74, 0x66, 0x67, 0x3c, 0xc6, 0xbc, 0x97, 0x99, 0x74, 0xc9, 0xcf, 0x12, 0x61, 0x9b, 0x9d, 0xc3, 0x18,
0xcd, 0xcf, 0xe0, 0x4e, 0xf0, 0x03, 0xcc, 0x0d, 0x4f, 0x5c, 0xf1, 0x01, 0xe5, 0x34, 0xe2, 0x43, 0xf3, 0x5e, 0x38, 0xd2, 0x25, 0x3f, 0xb3, 0x7e, 0x84, 0x1f, 0x60, 0x6a, 0xfc, 0xc4, 0x05, 0xef,
0xc8, 0x2e, 0xcd, 0x40, 0xc0, 0x15, 0x1f, 0xc0, 0x4c, 0x23, 0x3e, 0x24, 0xc3, 0x26, 0xf8, 0x09, 0x64, 0x20, 0x8d, 0x78, 0xd7, 0x64, 0xd7, 0x66, 0x4c, 0xc0, 0x05, 0xef, 0x98, 0x99, 0x46, 0xbc,
0x6e, 0xec, 0xc3, 0x61, 0xc4, 0x87, 0x08, 0xd2, 0x98, 0x8f, 0xde, 0x93, 0x4d, 0x6e, 0x83, 0xdf, 0xeb, 0x0c, 0x1b, 0xe1, 0x27, 0xb8, 0xb2, 0x0f, 0x87, 0x11, 0xef, 0x5a, 0x90, 0xc6, 0xbc, 0xf7,
0xa1, 0xfd, 0x3b, 0x7c, 0xf9, 0x17, 0x00, 0x00, 0xff, 0xff, 0x05, 0xbb, 0xfd, 0xc1, 0x4a, 0x04, 0x9e, 0x6c, 0x74, 0x13, 0xfc, 0x0a, 0xed, 0x7f, 0xc7, 0xe7, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff,
0x00, 0x00, 0xb7, 0x06, 0x45, 0x6a, 0x68, 0x04, 0x00, 0x00,
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.

View File

@ -41,7 +41,9 @@ message DeleteRequest {
message DeleteResponse {} message DeleteResponse {}
message ListRequest {} message ListRequest {
string namespace = 1;
}
message ListResponse { message ListResponse {
repeated Change values = 1; repeated Change values = 1;