Skip to content

Commit

Permalink
add DefaultInitialBalance
Browse files Browse the repository at this point in the history
  • Loading branch information
bxy4543 committed Aug 15, 2023
1 parent bc0187b commit 01cd5c5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions controllers/account/controllers/account_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ const (
NEWACCOUNTAMOUNTENV = "NEW_ACCOUNT_AMOUNT"
RECHARGEGIFT = "recharge-gift"
SEALOS = "sealos"
DefaultInitialBalance = 5_000_000
)

// AccountReconciler reconciles an Account object
Expand Down Expand Up @@ -262,10 +263,10 @@ func (r *AccountReconciler) syncAccount(ctx context.Context, name, accountNamesp
return &account, nil
}

// should set bonus amount that will give some money to new account
amount, err := strconv.Atoi(stringAmount)
amount, err := crypto.DecryptInt64(stringAmount)
if err != nil {
return nil, fmt.Errorf("convert %s to int failed: %v", stringAmount, err)
r.Logger.Error(err, "decrypt amount failed", "amount", stringAmount)
amount = DefaultInitialBalance
}
if _, err := controllerutil.CreateOrUpdate(ctx, r.Client, &account, func() error {
if account.Annotations == nil {
Expand Down
2 changes: 1 addition & 1 deletion controllers/account/deploy/manifests/deploy.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,7 @@ spec:
- name: NAMESPACE_NAME
value: user-system
- name: NEW_ACCOUNT_AMOUNT
value: "5000000"
value: "ri79LzQiQrs6CVa1ctE308+AseBXbOua0RIMCXAH5hc3irs="
- name: WHITELIST
value: notifications.Notification.notification.sealos.io/v1,payments.Payment.account.sealos.io/v1,billingrecordqueries.BillingRecordQuery.account.sealos.io/v1,pricequeries.PriceQuery.account.sealos.io/v1
- name: ACCOUNT_SYSTEM_NAMESPACE
Expand Down

0 comments on commit 01cd5c5

Please sign in to comment.