Skip to content

Commit

Permalink
edit wrong named enves
Browse files Browse the repository at this point in the history
  • Loading branch information
case0sh committed Oct 5, 2023
1 parent ba73588 commit dfb77d6
Show file tree
Hide file tree
Showing 23 changed files with 61 additions and 108 deletions.
98 changes: 49 additions & 49 deletions protogen/gen/ocis/messages/settings/v0/settings.pb.go

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion services/auth-machine/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ type Config struct {

SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token" env:"AUTH_MACHINE_SKIP_USER_GROUPS_IN_TOKEN" desc:"Disables the encoding of the user's group memberships in the reva access token. This reduces the token size, especially when users are members of a large number of groups."`

MachineAuthAPIKey string `yaml:"machine_auth_api_key" env:"OCIS_MACHINE_AUTH_API_KEY;AUTH_MACHINE_API_KEY" desc:"Machine auth API key used to validate internal requests necessary for the access to resources from other services."`

Supervised bool `yaml:"-"`
Context context.Context `yaml:"-"`
Expand Down
4 changes: 0 additions & 4 deletions services/auth-machine/pkg/config/defaults/defaultconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@ func EnsureDefaults(cfg *config.Config) {
cfg.TokenManager = &config.TokenManager{}
}

if cfg.MachineAuthAPIKey == "" && cfg.Commons != nil && cfg.Commons.MachineAuthAPIKey != "" {
cfg.MachineAuthAPIKey = cfg.Commons.MachineAuthAPIKey
}

if cfg.GRPC.TLS == nil && cfg.Commons != nil {
cfg.GRPC.TLS = structs.CopyOrZeroValue(cfg.Commons.GRPCServiceTLS)
}
Expand Down
4 changes: 0 additions & 4 deletions services/auth-machine/pkg/config/parser/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,5 @@ func Validate(cfg *config.Config) error {
if cfg.TokenManager.JWTSecret == "" {
return shared.MissingJWTTokenError(cfg.Service.Name)
}

if cfg.MachineAuthAPIKey == "" {
return shared.MissingMachineAuthApiKeyError(cfg.Service.Name)
}
return nil
}
1 change: 0 additions & 1 deletion services/auth-machine/pkg/revaconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ func AuthMachineConfigFromStruct(cfg *config.Config) map[string]interface{} {
"auth_manager": "machine",
"auth_managers": map[string]interface{}{
"machine": map[string]interface{}{
"api_key": cfg.MachineAuthAPIKey,
"gateway_addr": cfg.Reva.Address,
},
},
Expand Down
8 changes: 4 additions & 4 deletions services/clientlog/pkg/config/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package config

// Debug defines the available debug configuration.
type Debug struct {
Addr string `yaml:"addr" env:"USERLOG_DEBUG_ADDR" desc:"Bind address of the debug server, where metrics, health, config and debug endpoints will be exposed."`
Token string `yaml:"token" env:"USERLOG_DEBUG_TOKEN" desc:"Token to secure the metrics endpoint."`
Pprof bool `yaml:"pprof" env:"USERLOG_DEBUG_PPROF" desc:"Enables pprof, which can be used for profiling."`
Zpages bool `yaml:"zpages" env:"USERLOG_DEBUG_ZPAGES" desc:"Enables zpages, which can be used for collecting and viewing in-memory traces."`
Addr string `yaml:"addr" env:"CLIENTLOG_DEBUG_ADDR" desc:"Bind address of the debug server, where metrics, health, config and debug endpoints will be exposed."`
Token string `yaml:"token" env:"CLIENTLOG_DEBUG_TOKEN" desc:"Token to secure the metrics endpoint."`
Pprof bool `yaml:"pprof" env:"CLIENTLOG_DEBUG_PPROF" desc:"Enables pprof, which can be used for profiling."`
Zpages bool `yaml:"zpages" env:"CLIENTLOG_DEBUG_ZPAGES" desc:"Enables zpages, which can be used for collecting and viewing in-memory traces."`
}
8 changes: 4 additions & 4 deletions services/clientlog/pkg/config/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package config

// Log defines the available log configuration.
type Log struct {
Level string `mapstructure:"level" env:"OCIS_LOG_LEVEL;USERLOG_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'."`
Pretty bool `mapstructure:"pretty" env:"OCIS_LOG_PRETTY;USERLOG_LOG_PRETTY" desc:"Activates pretty log output."`
Color bool `mapstructure:"color" env:"OCIS_LOG_COLOR;USERLOG_LOG_COLOR" desc:"Activates colorized log output."`
File string `mapstructure:"file" env:"OCIS_LOG_FILE;USERLOG_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set."`
Level string `mapstructure:"level" env:"OCIS_LOG_LEVEL;CLIENTLOG_USERLOG_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'."`
Pretty bool `mapstructure:"pretty" env:"OCIS_LOG_PRETTY;CLIENTLOG_USERLOG_LOG_PRETTY" desc:"Activates pretty log output."`
Color bool `mapstructure:"color" env:"OCIS_LOG_COLOR;CLIENTLOG_USERLOG_LOG_COLOR" desc:"Activates colorized log output."`
File string `mapstructure:"file" env:"OCIS_LOG_FILE;CLIENTLOG_USERLOG_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set."`
}
1 change: 0 additions & 1 deletion services/frontend/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ type Config struct {

TokenManager *TokenManager `yaml:"token_manager"`
Reva *shared.Reva `yaml:"reva"`
MachineAuthAPIKey string `yaml:"machine_auth_api_key" env:"OCIS_MACHINE_AUTH_API_KEY;FRONTEND_MACHINE_AUTH_API_KEY" desc:"The machine auth API key used to validate internal requests necessary to access resources from other services."`

SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token" env:"FRONTEND_SKIP_USER_GROUPS_IN_TOKEN" desc:"Disables the loading of user's group memberships from the reva access token."`

Expand Down
4 changes: 0 additions & 4 deletions services/frontend/pkg/config/defaults/defaultconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,6 @@ func EnsureDefaults(cfg *config.Config) {
cfg.TransferSecret = cfg.Commons.TransferSecret
}

if cfg.MachineAuthAPIKey == "" && cfg.Commons != nil && cfg.Commons.MachineAuthAPIKey != "" {
cfg.MachineAuthAPIKey = cfg.Commons.MachineAuthAPIKey
}

}

// Sanitize sanitized the configuration
Expand Down
4 changes: 0 additions & 4 deletions services/frontend/pkg/config/parser/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ func Validate(cfg *config.Config) error {
return shared.MissingRevaTransferSecretError(cfg.Service.Name)
}

if cfg.MachineAuthAPIKey == "" {
return shared.MissingMachineAuthApiKeyError(cfg.Service.Name)
}

if cfg.GRPCClientTLS == nil && cfg.Commons != nil {
cfg.GRPCClientTLS = structs.CopyOrZeroValue(cfg.Commons.GRPCClientTLS)
}
Expand Down
1 change: 0 additions & 1 deletion services/frontend/pkg/revaconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ func FrontendConfigFromStruct(cfg *config.Config, logger log.Logger) (map[string
"stat_cache_table": cfg.OCS.StatCacheTable,
"prefix": cfg.OCS.Prefix,
"additional_info_attribute": cfg.OCS.AdditionalInfoAttribute,
"machine_auth_apikey": cfg.MachineAuthAPIKey,
"enable_denials": cfg.OCS.EnableDenials,
"cache_warmup_driver": cfg.OCS.CacheWarmupDriver,
"cache_warmup_drivers": map[string]interface{}{
Expand Down
1 change: 0 additions & 1 deletion services/idp/pkg/backends/cs3/bootstrap/cs3.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ func NewIdentityManager(bs bootstrap.Bootstrap) (identity.Manager, error) {
config.TLSClientConfig,
// FIXME add a map[string]interface{} property to the lico config.Config so backends can pass custom config parameters through the bootstrap process
os.Getenv("CS3_GATEWAY"),
os.Getenv("CS3_MACHINE_AUTH_API_KEY"),
config.Settings.Insecure,
)
if identifierErr != nil {
Expand Down
4 changes: 0 additions & 4 deletions services/idp/pkg/backends/cs3/identifier/cs3.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ type CS3Backend struct {
logger logrus.FieldLogger
tlsConfig *tls.Config
gatewayURI string
machineAuthAPIKey string
insecure bool

sessions cmap.ConcurrentMap
Expand All @@ -49,7 +48,6 @@ func NewCS3Backend(
c *config.Config,
tlsConfig *tls.Config,
gatewayURI string,
machineAuthAPIKey string,
insecure bool,
) (*CS3Backend, error) {

Expand All @@ -63,7 +61,6 @@ func NewCS3Backend(
logger: c.Logger,
tlsConfig: tlsConfig,
gatewayURI: gatewayURI,
machineAuthAPIKey: machineAuthAPIKey,
insecure: insecure,

sessions: cmap.New(),
Expand Down Expand Up @@ -159,7 +156,6 @@ func (b *CS3Backend) ResolveUserByUsername(ctx context.Context, username string)
res, err := client.Authenticate(ctx, &cs3gateway.AuthenticateRequest{
Type: "machine",
ClientId: "username:" + username,
ClientSecret: b.machineAuthAPIKey,
})
if err != nil {
return nil, fmt.Errorf("cs3 backend machine authenticate rpc error: %v", err)
Expand Down
1 change: 0 additions & 1 deletion services/idp/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ type Config struct {

Reva *shared.Reva `yaml:"reva"`

MachineAuthAPIKey string `yaml:"machine_auth_api_key" env:"OCIS_MACHINE_AUTH_API_KEY;IDP_MACHINE_AUTH_API_KEY" desc:"Machine auth API key used to validate internal requests necessary for the access to resources from other services."`

Asset Asset `yaml:"asset"`
IDP Settings `yaml:"idp"`
Expand Down
4 changes: 1 addition & 3 deletions services/idp/pkg/config/defaults/defaultconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,7 @@ func EnsureDefaults(cfg *config.Config) {
cfg.Reva = structs.CopyOrZeroValue(cfg.Commons.Reva)
}

if cfg.MachineAuthAPIKey == "" && cfg.Commons != nil && cfg.Commons.MachineAuthAPIKey != "" {
cfg.MachineAuthAPIKey = cfg.Commons.MachineAuthAPIKey
}

}

// Sanitize sanitizes the configuration
Expand Down
4 changes: 0 additions & 4 deletions services/idp/pkg/config/parser/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ func ParseConfig(cfg *config.Config) error {

func Validate(cfg *config.Config) error {
switch cfg.IDP.IdentityManager {
case "cs3":
if cfg.MachineAuthAPIKey == "" {
return shared.MissingMachineAuthApiKeyError(cfg.Service.Name)
}
case "ldap":
if cfg.Ldap.BindPassword == "" {
return shared.MissingLDAPBindPassword(cfg.Service.Name)
Expand Down
5 changes: 2 additions & 3 deletions services/idp/pkg/service/v0/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func NewService(opts ...Option) Service {
switch options.Config.IDP.IdentityManager {
case "cs3":
cs3BackendSupport.MustRegister()
if err := initCS3EnvVars(options.Config.Reva.Address, options.Config.MachineAuthAPIKey); err != nil {
if err := initCS3EnvVars(options.Config.Reva.Address); err != nil {
logger.Fatal().Err(err).Msg("could not initialize cs3 backend env vars")
}
case "ldap":
Expand Down Expand Up @@ -152,10 +152,9 @@ func createTemporaryClientsConfig(filePath, ocisURL string, clients []config.Cli
}

// Init cs3 backend vars which are currently not accessible via idp api
func initCS3EnvVars(cs3Addr, machineAuthAPIKey string) error {
func initCS3EnvVars(cs3Addr string) error {
defaults := map[string]string{
"CS3_GATEWAY": cs3Addr,
"CS3_MACHINE_AUTH_API_KEY": machineAuthAPIKey,
}

for k, v := range defaults {
Expand Down
1 change: 0 additions & 1 deletion services/ocdav/pkg/command/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ func Server(cfg *config.Config) *cli.Command {
ocdav.Version(cfg.Status.Version),
ocdav.VersionString(cfg.Status.VersionString),
ocdav.Edition(cfg.Status.Edition),
ocdav.MachineAuthAPIKey(cfg.MachineAuthAPIKey),
ocdav.Broker(broker.NoOp{}),
// ocdav.FavoriteManager() // FIXME needs a proper persistence implementation https://github.com/owncloud/ocis/issues/1228
// ocdav.LockSystem(), // will default to the CS3 lock system
Expand Down
1 change: 0 additions & 1 deletion services/ocdav/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ type Config struct {
// Timeout in seconds when making requests to the gateway
Timeout int64 `yaml:"gateway_request_timeout" env:"OCDAV_GATEWAY_REQUEST_TIMEOUT" desc:"Request timeout in seconds for requests from the oCDAV service to the GATEWAY service."`

MachineAuthAPIKey string `yaml:"machine_auth_api_key" env:"OCIS_MACHINE_AUTH_API_KEY;OCDAV_MACHINE_AUTH_API_KEY" desc:"Machine auth API key used to validate internal requests necessary for the access to resources from other services."`

Context context.Context `yaml:"-"`
Status Status `yaml:"-"`
Expand Down
5 changes: 0 additions & 5 deletions services/ocdav/pkg/config/defaults/defaultconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ func DefaultConfig() *config.Config {
PublicURL: "https://localhost:9200",
Insecure: false,
Timeout: 84300,
MachineAuthAPIKey: "",
Status: config.Status{
Version: version.Legacy,
VersionString: version.LegacyString,
Expand Down Expand Up @@ -132,10 +131,6 @@ func EnsureDefaults(cfg *config.Config) {
} else if cfg.TokenManager == nil {
cfg.TokenManager = &config.TokenManager{}
}

if cfg.MachineAuthAPIKey == "" && cfg.Commons != nil && cfg.Commons.MachineAuthAPIKey != "" {
cfg.MachineAuthAPIKey = cfg.Commons.MachineAuthAPIKey
}
}

// Sanitize sanitizes the configuration
Expand Down
4 changes: 0 additions & 4 deletions services/ocdav/pkg/config/parser/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,5 @@ func Validate(cfg *config.Config) error {
if cfg.TokenManager.JWTSecret == "" {
return shared.MissingJWTTokenError(cfg.Service.Name)
}
if cfg.MachineAuthAPIKey == "" {
return shared.MissingMachineAuthApiKeyError(cfg.Service.Name)
}

return nil
}
1 change: 0 additions & 1 deletion services/policies/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ type Config struct {
Events Events `yaml:"events"`
Reva *shared.Reva `yaml:"reva"`
GRPCClientTLS *shared.GRPCClientTLS `yaml:"grpc_client_tls"`
MachineAuthAPIKey string `yaml:"machine_auth_api_key" env:"OCIS_MACHINE_AUTH_API_KEY;POLICIES_MACHINE_AUTH_API_KEY" desc:"Machine auth API key used to validate internal requests necessary for the access to resources from other services."`
Context context.Context `yaml:"-"`
Log *Log `yaml:"log"`
Engine Engine `yaml:"engine"`
Expand Down
4 changes: 1 addition & 3 deletions services/policies/pkg/config/defaults/defaultconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ func EnsureDefaults(cfg *config.Config) {
} else if cfg.TokenManager == nil {
cfg.TokenManager = &config.TokenManager{}
}
if cfg.MachineAuthAPIKey == "" && cfg.Commons != nil && cfg.Commons.MachineAuthAPIKey != "" {
cfg.MachineAuthAPIKey = cfg.Commons.MachineAuthAPIKey
}


if cfg.Reva == nil && cfg.Commons != nil && cfg.Commons.Reva != nil {
cfg.Reva = &shared.Reva{
Expand Down

0 comments on commit dfb77d6

Please sign in to comment.