module

CB

TODO (abrightwell): We had to explicitly qualify this class name as an Action due to conflicts with the below Token struct. Would be great to potentially namespace actions under CB::Action or something. Something perhaps worth considering.

Constants

API_NAME_PATTERN = /\A[\p{L}\p{So}][\p{L}\p{N}\p{So}\/\-_ ']{3,48}[\p{L}\p{N}\p{So}]\z/

For user specified API resource names such as cluster and team names.

BUILD_RELEASE = {{ flag?(:release) }}

Release constants.

BUILD_SHA = {{ (env("GIT_SHA")) || (`git describe --match=NeVeRmAtCh --always --dirty 2> /dev/null || echo \"unknown sha\"`).chomp.stringify }}
DASHBOARD_HOST = ENV["CB_DASHBOARD_HOST"]? || (HOST.gsub(/\Aapi\./, ""))
EID_PATTERN = /\A[a-z0-9]{25}[4aeimquy]\z/
HOST = ENV["CB_HOST"]? || "api.crunchybridge.com"
IDENT_PATTERN = /\A[a-z0-9\-]+\z/

For simple identifiers such as region names, or plan names where we expect only lowercase, numbers, and -

PSQLRC = File.expand_path(ENV["PSQLRC"]? || "~/.psqlrc", home: true)
SHARDS_VERSION = {{ (`shards version \"/tmp/tmp.fakbnO/src/src\"`).chomp.stringify }}
SSL_CERT_FILE = ENV["SSL_CERT_FILE"]? || find_default_path

Allow manually overriding the cert file location

TEAM_ROLE_ADMIN = "admin"
TEAM_ROLE_MANAGER = "manager"
TEAM_ROLE_MEMBER = "member"
VALID_TEAM_ROLES = Set {TEAM_ROLE_ADMIN, TEAM_ROLE_MANAGER, TEAM_ROLE_MEMBER}

Valid team member roles.

VERSION = begin {% if true %} %(#{SHARDS_VERSION}#{"-unrelease" unless BUILD_RELEASE}) {% end %} end
VERSION_STR = "cb v#{CB::VERSION} (#{CB::BUILD_SHA})"

Nested types