Skip to content

Commit 7c293ee

Browse files
author
Laurie T. Malau
committed
Retrieve price IDs config
1 parent 465cd24 commit 7c293ee

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

components/usage/pkg/server/server.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ import (
2626
"gorm.io/gorm"
2727
)
2828

29+
type PriceConfig struct {
30+
EUR string `json:"eur"`
31+
USD string `json:"usd"`
32+
}
33+
34+
type StripePrices struct {
35+
UsageProductPriceIDs PriceConfig `json:"usageProductPriceIds"`
36+
IndividualUsagePriceIDs PriceConfig `json:"individualUsagePriceIds"`
37+
TeamUsagePriceIDs PriceConfig `json:"teamUsagePriceIds"`
38+
}
2939
type Config struct {
3040
// ControllerSchedule determines how frequently to run the Usage/Billing controller.
3141
// When ControllerSchedule is empty, the background controller is disabled.
@@ -38,6 +48,8 @@ type Config struct {
3848
Server *baseserver.Configuration `json:"server,omitempty"`
3949

4050
DefaultSpendingLimit db.DefaultSpendingLimit `json:"defaultSpendingLimit"`
51+
52+
StripePrices StripePrices `json:"stripePrices"`
4153
}
4254

4355
func Start(cfg Config, version string) error {

install/installer/pkg/components/usage/configmap.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,21 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
3333
ForUsers: 1_000_000_000,
3434
MinForUsersOnStripe: 0,
3535
},
36+
// TODO: Remove hardcoded IDs
37+
StripePrices: server.StripePrices{
38+
UsageProductPriceIDs: server.PriceConfig{
39+
EUR: "price_1LmYVxGadRXm50o3AiLq0Qmo",
40+
USD: "price_1LmYWRGadRXm50o3Ym8PLqnG",
41+
},
42+
IndividualUsagePriceIDs: server.PriceConfig{
43+
EUR: "price_1LmY7GAyBDPbWrhaf8Lav5yd",
44+
USD: "price_1LmY86AyBDPbWrhahYRNNSK1",
45+
},
46+
TeamUsagePriceIDs: server.PriceConfig{
47+
EUR: "price_1LiJKtAyBDPbWrhaJ2rUVEBb",
48+
USD: "price_1LiJLDAyBDPbWrhaOeWsP7Yr",
49+
},
50+
},
3651
}
3752
expConfig := getExperimentalConfig(ctx)
3853

0 commit comments

Comments
 (0)