Skip to content

Commit

Permalink
feat: Add support for fee account configuration in Akash provider
Browse files Browse the repository at this point in the history
  • Loading branch information
pcfreak30 committed Jan 2, 2025
1 parent 0530014 commit 6319541
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions akash/client/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,10 @@ func (c AkashCommand) SetDepositorAccount(account string) AkashCommand {
return c.append("--depositor-account").append(account)
}

func (c AkashCommand) SetFeeAccount(account string) AkashCommand {
return c.append("--fee-account").append(account)
}

func (c AkashCommand) SetSignMode(mode string) AkashCommand {
if !envExists("AKASH_SIGN_MODE") {
supportedModes := map[string]bool{
Expand Down
1 change: 1 addition & 0 deletions akash/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ type AkashProviderConfiguration struct {
Path string
ProvidersApi string
DepositorAccount string
FeeAccount string
}

func (ak *AkashClient) GetContext() context.Context {
Expand Down
4 changes: 4 additions & 0 deletions akash/client/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ func transactionCreateDeployment(ak *AkashClient, manifestLocation string) (type
if ak.Config.DepositorAccount != "" {
cmd = cmd.SetDepositorAccount(ak.Config.DepositorAccount)
}

if ak.Config.FeeAccount != "" {
cmd = cmd.SetFeeAccount(ak.Config.FeeAccount)
}

cmd = cmd.OutputJson()

Expand Down
6 changes: 6 additions & 0 deletions akash/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ func Provider() *schema.Provider {
Optional: true,
DefaultFunc: schema.EnvDefaultFunc("AKASH_DEPOSITOR_ACCOUNT", ""),
},
"fee_account": {
Type: schema.TypeString,
Optional: true,
DefaultFunc: schema.EnvDefaultFunc("AKASH_FEE_ACCOUNT", ""),
},
},
ResourcesMap: map[string]*schema.Resource{
"akash_deployment": resourceDeployment(),
Expand Down Expand Up @@ -130,6 +135,7 @@ func providerConfigure(ctx context.Context, d *schema.ResourceData) (interface{}
Path: config[Path],
ProvidersApi: config[ProvidersApi],
DepositorAccount: d.Get("depositor_account").(string),
FeeAccount: d.Get("fee_account").(string),
}

tflog.Debug(ctx, fmt.Sprintf("Starting provider with %+v", configuration))
Expand Down

0 comments on commit 6319541

Please sign in to comment.