Skip to content

Commit

Permalink
Merge pull request #9 from protoconf/avivl/demoapp
Browse files Browse the repository at this point in the history
configs and proto for demoapp
  • Loading branch information
avivl authored Jun 21, 2024
2 parents d48a5aa + bdfe04e commit 0e3798a
Show file tree
Hide file tree
Showing 6 changed files with 380 additions and 0 deletions.
5 changes: 5 additions & 0 deletions demoapp/config/buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
version: v1
plugins:
- name: go
out: src
opt: paths=source_relative
15 changes: 15 additions & 0 deletions demoapp/config/buf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: v1beta1
breaking:
ignore_unstable_packages: true
use:
- FIELD_SAME_ONEOF
- FIELD_SAME_JSON_NAME
- FIELD_SAME_NAME
- FIELD_SAME_TYPE
- FIELD_SAME_LABEL
- FILE_SAME_PACKAGE
- FIELD_NO_DELETE_UNLESS_NUMBER_RESERVED
- FIELD_NO_DELETE_UNLESS_NAME_RESERVED
build:
roots:
- src
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"value": {
"@type": "type.googleapis.com/demoapp.v1.DemoConfig",
"title": "hello protoconf go-client!",
"version": "1.0.1",
"logLevel": "LOG_LEVEL_INFO"
},
"rolloutConfig": {
"stages": [
{
"channel": "p1",
"percentile": 20
},
{
"channel": "p2",
"percentile": 50
},
{
"channel": "p3",
"percentile": 90
}
]
}
}
287 changes: 287 additions & 0 deletions demoapp/config/src/demo/v1/config.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions demoapp/config/src/demo/v1/config.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
syntax = "proto3";

package demoapp.v1;

import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";


option go_package = "github.com/protoconf/client-go/demoapp/config/src/demo/v1;democonfig";

message DemoConfig {
string pod_name = 1;
string title = 2;
string version = 3;
LogLevel log_level = 4;
google.protobuf.Duration timeout = 5;
google.protobuf.Timestamp last_update = 6;
uint64 total_requests = 7;

enum LogLevel {
LOG_LEVEL_UNSPECIFIED = 0;
LOG_LEVEL_DEBUG = 1;
LOG_LEVEL_INFO = 2;
LOG_LEVEL_WARN = 3;
LOG_LEVEL_ERROR = 4;
}
}
22 changes: 22 additions & 0 deletions demoapp/config/src/demo/v1/demoapp.pconf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# vim: syntax=python
load("//demo/v1/config.proto", "DemoConfig")
load("//google/protobuf/duration.proto", "Duration")



def main():
config = DemoConfig(
title="hello protoconf go-client!",
version="1.0.1",
log_level=DemoConfig.LogLevel.LOG_LEVEL_INFO,
)

return ConfigRollout(
config,
# default_cooldown_time=Duration(seconds=20),
stages=[
RolloutStage(channel="p1", percentile=20),
RolloutStage(channel="p2", percentile=50),
RolloutStage(channel="p3", percentile=90),
],
)

0 comments on commit 0e3798a

Please sign in to comment.