<commit_before>////////////////////////////////////////////////////////////////////////////////
/// DISCLAIMER
///
/// Copyright 2016 ArangoDB GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
///     http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
///
/// @author Dr. <NAME>
////////////////////////////////////////////////////////////////////////////////

#ifndef APPLICATION_FEATURES_REST_SERVER_FEATURE_H
#define APPLICATION_FEATURES_REST_SERVER_FEATURE_H 1

#include "ApplicationFeatures/ApplicationFeature.h"

#include "Actions/RestActionHandler.h"
#include "VocBase/AuthInfo.h"

namespace arangodb {
namespace rest {
class AsyncJobManager;
class HttpHandlerFactory;
class HttpServer;
}

class RestServerThread;

class RestServerFeature final
    : public application_features::ApplicationFeature {
 public:
  static AuthInfo AUTH_INFO;

 public:
  static bool authenticationEnabled() {
    return RESTSERVER != nullptr && RESTSERVER->authentication();
  }
  
  static bool hasProxyCheck() {
    return RESTSERVER != nullptr && RESTSERVER->proxyCheck();
  }
  
  static std::vector<std::string> getTrustedProxies() {
    if (RESTSERVER == nullptr) {
      return std::vector<std::string>();
    }
    return RESTSERVER->trustedProxies();
  }

  static std::string getJwtSecret() {
    TRI_ASSERT(RESTSERVER != nullptr);
    return RESTSERVER->jwtSecret();
  }

 private:
  static RestServerFeature* RESTSERVER;
  static const size_t _maxSecretLength = 64;

 public:
  explicit RestServerFeature(application_features::ApplicationServer*);

 public:
  void collectOptions(std::shared_ptr<options::ProgramOptions>) override final;
  void validateOptions(std::shared_ptr<options::ProgramOptions>) override final;
  void prepare() override final;
  void start() override final;<commit_msg>Fixed a crash in RestServerFeature::getJWTSecret.<commit_after>////////////////////////////////////////////////////////////////////////////////
/// DISCLAIMER
///
/// Copyright 2016 ArangoDB GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
///     http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
///
/// @author Dr. <NAME>
////////////////////////////////////////////////////////////////////////////////

#ifndef APPLICATION_FEATURES_REST_SERVER_FEATURE_H
#define APPLICATION_FEATURES_REST_SERVER_FEATURE_H 1

#include "ApplicationFeatures/ApplicationFeature.h"

#include "Actions/RestActionHandler.h"
#include "VocBase/AuthInfo.h"

namespace arangodb {
namespace rest {
class AsyncJobManager;
class HttpHandlerFactory;
class HttpServer;
}

class RestServerThread;

class RestServerFeature final
    : public application_features::ApplicationFeature {
 public:
  static AuthInfo AUTH_INFO;

 public:
  static bool authenticationEnabled() {
    return RESTSERVER != nullptr && RESTSERVER->authentication();
  }
  
  static bool hasProxyCheck() {
    return RESTSERVER != nullptr && RESTSERVER->proxyCheck();
  }
  
  static std::vector<std::string> getTrustedProxies() {
    if (RESTSERVER == nullptr) {
      return std::vector<std::string>();
    }
    return RESTSERVER->trustedProxies();
  }

  static std::string getJwtSecret() {
    if (RESTSERVER == nullptr) {
      return std::string();
    }
    return RESTSERVER->jwtSecret();
  }

 private:
  static RestServerFeature* RESTSERVER;
  static const size_t _maxSecretLength = 64;

 public:
  explicit RestServerFeature(application_features::ApplicationServer*);

 public:
  void collectOptions(std::shared_ptr<options::ProgramOptions>) override final;
  void validateOptions(std::shared_ptr<options::ProgramOptions>) override final;
  void prepare() override final;
  void start() override final;
{'fraction_non_alphanumeric': 0.16737019839594766, 'fraction_numerical': 0.004643309413254538, 'mean_word_length': 3.1101474414570687, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '807077', 'n_tokens_mistral': 1260, 'n_tokens_neox': 1200, 'n_words': 384}