owncloud / owncloud/ocis

Automate deprecated variable removal

Open
#7,105 2 comments 0 reactions 0 assignees View on GitHub
Category:Enhancement
Dominant language
Go
Stars
2.1k
Forks
274
Avg merge
2d 1h
Merged PRs (30d)
103

Description

We have introduced a method to mark variables as deprecated and removal in our code like:

```go
// Reva defines all available REVA client configuration.
type Reva struct {
Address string `yaml:"address" env:"OCIS_REVA_GATEWAY;REVA_GATEWAY" desc:"The CS3 gateway endpoint." deprecationVersion:"3.0" removalVersion:"4.0.0" deprecationInfo:"REVA_GATEWAY changing name for consistency" deprecationReplacement:"OCIS_REVA_GATEWAY"`
TLS GRPCClientTLS `yaml:"tls"`
}
```

this came in handy when removing the variables for `4.0.0` (see #7099). I just realized that removing all the variables from the seperate `config.go` files is an effort that could be automated.

I suggest we write a small tool that will patch this code automatically

**Workflow:**

```bash
$> ./deprecation_helper
```

This will remove all the variables and deprecation annotations from the code in the `config.go` files and will just leave us with the actual occurrences in the code, thus reducing the workload that is actually needed to remove those variables (pressing delete hundreds of time is just a waste of precious time). It would also be helpful to add an additional helper function to that tool that would point to locations where those variables are used directly through `os.GetEnv()` or occur in static strings etc.

**Addiotional (needed) functionality:**
- Whenever a variable is removed, it needs to be written to a (text-)database
- Upon startup ocis checks for the contents of the database, and checks if the variables are set
- if one of the variables is still set, ocis will refuse to start up
- deprecated variables should also be added to this database and create a log output if set upon startup
- if there are deprecated or removed variables still set, admin (ui admin, not sysadmin) should see a toast in the ui hinting the person to contact the sysadmin to check the config
- **Note:** These database(s) need to bee added to the git-repo and need to be bundled upon build!

/cc @kobergj @mmattel

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.