Skip to content

Commit

Permalink
Rename ADMIN_USER_ID env var to OCIS_ADMIN_USER_ID
Browse files Browse the repository at this point in the history
Also let the top-level ocis config validator error out if admin_user_id
is unset at start.
  • Loading branch information
rhafer committed May 4, 2022
1 parent 42f07cc commit dda4b8f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
9 changes: 5 additions & 4 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@
"OCIS_LOG_LEVEL": "debug",
"OCIS_LOG_PRETTY": "true",
"OCIS_LOG_COLOR": "true",
// enable basic auth for dev setup so that we can use curl for testing
"PROXY_ENABLE_BASIC_AUTH": "true",
// user id of "admin", for user creation and admin role assignement
"OCIS_ADMIN_USER_ID": "admin-user-id",
// set insecure options because we don't have valid certificates in dev environments
"OCIS_INSECURE": "true",
// set some hardcoded secrets
"OCIS_JWT_SECRET": "some-ocis-jwt-secret",
"STORAGE_TRANSFER_SECRET": "some-ocis-transfer-secret",
"OCIS_MACHINE_AUTH_API_KEY": "some-ocis-machine-auth-api-key",
"STORAGE_TRANSFER_SECRET": "some-ocis-transfer-secret",
// enable basic auth for dev setup so that we can use curl for testing
"PROXY_ENABLE_BASIC_AUTH": "true",
// idm ldap
"IDM_SVC_PASSWORD": "some-ldap-idm-password",
"GRAPH_LDAP_BIND_PASSWORD": "some-ldap-idm-password",
Expand All @@ -36,7 +38,6 @@
"IDP_LDAP_BIND_PASSWORD": "some-ldap-idp-password",
// admin user default password
"IDM_ADMIN_PASSWORD": "admin",
"ADMIN_USER_ID": "admin",
// demo users
"IDM_CREATE_DEMO_USERS": "true",
// metadata storage
Expand Down
2 changes: 1 addition & 1 deletion ocis-pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ type Config struct {
MachineAuthAPIKey string `yaml:"machine_auth_api_key" env:"OCIS_MACHINE_AUTH_API_KEY"`
TransferSecret string `yaml:"transfer_secret" env:"STORAGE_TRANSFER_SECRET"`
SystemUserID string `yaml:"system_user_id" env:"OCIS_SYSTEM_USER_ID"`
AdminUserID string `yaml:"admin_user_id" env:"ADMIN_USER_ID"`
AdminUserID string `yaml:"admin_user_id" env:"OCIS_ADMIN_USER_ID"`
Runtime Runtime `yaml:"runtime"`

Accounts *accounts.Config `yaml:"accounts"`
Expand Down
4 changes: 4 additions & 0 deletions ocis-pkg/config/parser/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,5 +122,9 @@ func Validate(cfg *config.Config) error {
return shared.MissingSystemUserID("ocis")
}

if cfg.AdminUserID == "" {
return shared.MissingAdminUserID("ocis")
}

return nil
}
2 changes: 1 addition & 1 deletion ocis-pkg/shared/shared_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ type Commons struct {
MachineAuthAPIKey string `yaml:"machine_auth_api_key" env:"OCIS_MACHINE_AUTH_API_KEY"`
TransferSecret string `yaml:"transfer_secret,omitempty" env:"REVA_TRANSFER_SECRET"`
SystemUserID string `yaml:"system_user_id" env:"OCIS_SYSTEM_USER_ID"`
AdminUserID string `yaml:"admin_user_id" env:"ADMIN_USER_ID"`
AdminUserID string `yaml:"admin_user_id" env:"OCIS_ADMIN_USER_ID"`
}

0 comments on commit dda4b8f

Please sign in to comment.