mirror of
https://github.com/Luzifer/ots.git
synced 2025-04-19 15:05:57 -04:00
renamed SecretExpiry to MaxSecretExpiry
This commit is contained in:
parent
f2a7af30b2
commit
a3554d3551
@ -143,7 +143,7 @@
|
||||
* Only mention tool name in footer (#71)
|
||||
* Replace redis client, move expiry into creation interface
|
||||
|
||||
With this release an old migration was removed and in case you are still using the `REDIS_EXPIRY` environment variable you need to switch to `SECRET_EXPIRY`. Also with the new redis client you might need to adjust the username in your `REDIS_URL` to a proper ACL username (or enable legacy auth in Redis) - see the README for the `REDIS_URL` format.
|
||||
With this release an old migration was removed and in case you are still using the `REDIS_EXPIRY` environment variable you need to switch to `MAX_SECRET_EXPIRY`. Also with the new redis client you might need to adjust the username in your `REDIS_URL` to a proper ACL username (or enable legacy auth in Redis) - see the README for the `REDIS_URL` format.
|
||||
|
||||
# 1.0.0 / 2023-04-14
|
||||
|
||||
|
@ -28,7 +28,7 @@ For a better setup you can choose the backend which is used to store the secrets
|
||||
(pre Redis v6 use `auth` as user, afterwards use a user available in your ACLs)
|
||||
- `REDIS_KEY` - Key prefix to store the keys under (Default `io.luzifer.ots`)
|
||||
- Common options
|
||||
- `SECRET_EXPIRY` - Expiry of the keys in seconds (Default `0` = no expiry)
|
||||
- `MAX_SECRET_EXPIRY` - Expiry of the keys in seconds (Default `0` = no expiry)
|
||||
|
||||
### Customization
|
||||
|
||||
|
4
api.go
4
api.go
@ -63,12 +63,12 @@ func (a apiServer) handleCreate(res http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
var (
|
||||
expiry = cfg.SecretExpiry
|
||||
expiry = cfg.MaxSecretExpiry
|
||||
secret string
|
||||
)
|
||||
|
||||
if !cust.DisableExpiryOverride {
|
||||
if ev, err := strconv.ParseInt(r.URL.Query().Get("expire"), 10, 64); err == nil && (ev < expiry || cfg.SecretExpiry == 0) {
|
||||
if ev, err := strconv.ParseInt(r.URL.Query().Get("expire"), 10, 64); err == nil && (ev < expiry || cfg.MaxSecretExpiry == 0) {
|
||||
expiry = ev
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ services:
|
||||
# See README for details
|
||||
REDIS_URL: redis://redis:6379/0
|
||||
# 168h = 1w
|
||||
SECRET_EXPIRY: "604800"
|
||||
MAX_SECRET_EXPIRY: "604800"
|
||||
# "mem" or "redis" (See README)
|
||||
STORAGE_TYPE: redis
|
||||
depends_on:
|
||||
|
@ -118,7 +118,7 @@ spec:
|
||||
value: tcp://ots-redis:6379
|
||||
- name: REDIS_KEY
|
||||
value: ots
|
||||
- name: SECRET_EXPIRY
|
||||
- name: MAX_SECRET_EXPIRY
|
||||
value: "172800"
|
||||
volumeMounts:
|
||||
- mountPath: /custom
|
||||
|
18
main.go
18
main.go
@ -27,12 +27,12 @@ const scriptNonceSize = 32
|
||||
|
||||
var (
|
||||
cfg struct {
|
||||
Customize string `flag:"customize" default:"" description:"Customize-File to load"`
|
||||
Listen string `flag:"listen" default:":3000" description:"IP/Port to listen on"`
|
||||
LogLevel string `flag:"log-level" default:"info" description:"Set log level (debug, info, warning, error)"`
|
||||
SecretExpiry int64 `flag:"secret-expiry" default:"0" description:"Maximum expiry of the stored secrets in seconds"`
|
||||
StorageType string `flag:"storage-type" default:"mem" description:"Storage to use for putting secrets to" validate:"nonzero"`
|
||||
VersionAndExit bool `flag:"version" default:"false" description:"Print version information and exit"`
|
||||
Customize string `flag:"customize" default:"" description:"Customize-File to load"`
|
||||
Listen string `flag:"listen" default:":3000" description:"IP/Port to listen on"`
|
||||
LogLevel string `flag:"log-level" default:"info" description:"Set log level (debug, info, warning, error)"`
|
||||
MaxSecretExpiry int64 `flag:"max-secret-expiry" default:"0" description:"Maximum expiry of the stored secrets in seconds"`
|
||||
StorageType string `flag:"storage-type" default:"mem" description:"Storage to use for putting secrets to" validate:"nonzero"`
|
||||
VersionAndExit bool `flag:"version" default:"false" description:"Print version information and exit"`
|
||||
}
|
||||
|
||||
assets file_helpers.FSStack
|
||||
@ -154,8 +154,8 @@ func main() {
|
||||
|
||||
// Start server
|
||||
logrus.WithFields(logrus.Fields{
|
||||
"secret_expiry": time.Duration(cfg.SecretExpiry) * time.Second,
|
||||
"version": version,
|
||||
"max_secret_expiry": time.Duration(cfg.MaxSecretExpiry) * time.Second,
|
||||
"version": version,
|
||||
}).Info("ots started")
|
||||
|
||||
if err = server.ListenAndServe(); err != nil {
|
||||
@ -216,7 +216,7 @@ func handleIndex(w http.ResponseWriter, _ *http.Request) {
|
||||
}{
|
||||
Customize: cust,
|
||||
InlineContentNonce: inlineContentNonceStr,
|
||||
MaxSecretExpiry: cfg.SecretExpiry,
|
||||
MaxSecretExpiry: cfg.MaxSecretExpiry,
|
||||
Version: version,
|
||||
}); err != nil {
|
||||
http.Error(w, errors.Wrap(err, "executing template").Error(), http.StatusInternalServerError)
|
||||
|
Loading…
x
Reference in New Issue
Block a user