1
#pragma once
2

            
3
#include <string>
4

            
5
#include "envoy/config/core/v3/base.pb.h"
6

            
7
#include "source/common/singleton/const_singleton.h"
8
#include "source/common/version/version_number.h"
9

            
10
namespace Envoy {
11

            
12
class VersionInfoTestPeer;
13

            
14
/**
15
 * Wraps compiled in code versioning.
16
 */
17
class VersionInfo {
18
public:
19
  // Repository revision (e.g. git SHA1).
20
  static const std::string& revision();
21
  // Repository status (e.g. clean, modified).
22
  static const std::string& revisionStatus();
23
  // Repository information and build type.
24
  static const std::string& version();
25
  // FIPS Compliance of envoy build
26
  static bool sslFipsCompliant();
27

            
28
  static const envoy::config::core::v3::BuildVersion& buildVersion();
29

            
30
private:
31
  friend class Envoy::VersionInfoTestPeer;
32
  // RELEASE or DEBUG
33
  static const std::string& buildType();
34
  static const std::string& sslVersion();
35
  static envoy::config::core::v3::BuildVersion makeBuildVersion(const char* version);
36
};
37

            
38
class BuildVersionMetadata {
39
public:
40
  // Type of build: RELEASE or DEBUG
41
  const std::string BuildType = "build.type";
42
  // Build label from the VERSION file
43
  const std::string BuildLabel = "build.label";
44
  // Version of the SSL implementation
45
  const std::string SslVersion = "ssl.version";
46
  // SCM revision of the source tree
47
  const std::string RevisionSHA = "revision.sha";
48
  // SCM status of the source tree
49
  const std::string RevisionStatus = "revision.status";
50
};
51

            
52
using BuildVersionMetadataKeys = ConstSingleton<BuildVersionMetadata>;
53

            
54
} // namespace Envoy