mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 00:39:13 +00:00
fix(config): improve container detection (#420)
fix(config): detect container
This commit is contained in:
parent
8457222b28
commit
765215270a
3 changed files with 80 additions and 42 deletions
|
@ -43,7 +43,7 @@ func (s *service) List(ctx context.Context) ([]domain.APIKey, error) {
|
|||
}
|
||||
|
||||
func (s *service) Store(ctx context.Context, key *domain.APIKey) error {
|
||||
key.Key = generateSecureToken(16)
|
||||
key.Key = GenerateSecureToken(16)
|
||||
|
||||
if err := s.repo.Store(ctx, key); err != nil {
|
||||
return err
|
||||
|
@ -82,7 +82,7 @@ func (s *service) ValidateAPIKey(ctx context.Context, key string) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
func generateSecureToken(length int) string {
|
||||
func GenerateSecureToken(length int) string {
|
||||
b := make([]byte, length)
|
||||
if _, err := rand.Read(b); err != nil {
|
||||
return ""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue