Skip to content

Commit

Permalink
added service roles to register service actions with IAM
Browse files Browse the repository at this point in the history
  • Loading branch information
vramk23 committed Aug 22, 2023
1 parent b1b3f6d commit a3ddea2
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion dockerfiles/server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ RUN CGO_ENABLED=0 go build -o ./build/server cmd/server/main.go

FROM alpine:3.16
RUN apk add --no-cache libc6-compat
COPY --from=builder ./store-apps /store-apps
COPY --from=builder ./data /data
COPY --from=builder ./build/server server

USER 65532:65532
Expand Down
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion server/pkg/iam-client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (c *Client) RegisterRolesActions() error {
iamConn := cm.NewIamConn(
cm.WithGrpcDialOption(grpcOpts...),
cm.WithIamAddress(c.cfg.IAMURL),
cm.WithIamYamlPath("provide the yaml location here"),
cm.WithIamYamlPath(c.cfg.ServiceRolesConfigFilePath),
)

ctx := context.Background()
Expand Down
8 changes: 5 additions & 3 deletions server/pkg/iam-client/register_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ import (
)

type Config struct {
IAMURL string `envconfig:"IAM_URL" required:"true"`
ServiceRegister bool `envconfig:"SERVICE_REGISTER" default:"false"`
ServiceName string `envconfig:"SERVICE_NAME" default:"capten-server"`
IAMURL string `envconfig:"IAM_URL" required:"true"`
ServiceRegister bool `envconfig:"SERVICE_REGISTER" default:"false"`
ServiceName string `envconfig:"SERVICE_NAME" default:"capten-server"`
ServiceRolesConfigFilePath string `envconfig:"SERVICE_ROLES_CONFIG_FILE_PATH" default:"/data/service-config/roles.yaml"`
}

func NewConfig() (Config, error) {
Expand Down Expand Up @@ -47,5 +48,6 @@ func RegisterService(log logging.Logger) error {
if err != nil {
return errors.WithMessage(err, "Registering Roles and Actions in IAM failed")
}
log.Infof("service registration successful")
return nil
}
4 changes: 2 additions & 2 deletions server/pkg/store-apps/sync_store_apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import (
)

type Config struct {
AppStoreAppConfigPath string `envconfig:"APP_STORE_APP_CONFIG_PATH" default:"/store-apps/conf"`
AppStoreAppConfigPath string `envconfig:"APP_STORE_APP_CONFIG_PATH" default:"/data/store-apps/conf"`
SyncAppStore bool `envconfig:"SYNC_APP_STORE" default:"false"`
AppStoreConfigFile string `envconfig:"APP_STORE_CONFIG_FILE" default:"/store-apps/app_list.yaml"`
AppStoreConfigFile string `envconfig:"APP_STORE_CONFIG_FILE" default:"/data/store-apps/app_list.yaml"`
}

type AppStoreConfig struct {
Expand Down

0 comments on commit a3ddea2

Please sign in to comment.