2022-10-12 11:01:33 +00:00
|
|
|
{ pkgs, ... }:
|
2022-03-02 23:34:18 +00:00
|
|
|
with pkgs.nodePackages;
|
|
|
|
''
|
2022-10-12 11:01:33 +00:00
|
|
|
# Script to set the docker, triton, manta and CNS env vars for the current
|
2022-06-09 12:29:45 +00:00
|
|
|
# triton profile
|
2022-10-12 11:01:33 +00:00
|
|
|
# Docs: https://docs.greenbaum.cloud/en/devops/triton-cli.html
|
|
|
|
# triton CLI source: https://github.com/tritonDataCenter/node-triton
|
|
|
|
cnsBaseDomain=$TRITONSHELL_CNS_BASE_DOMAIN
|
|
|
|
dataCenters=$TRITONSHELL_DATA_CENTERS
|
|
|
|
mantaDomain=$TRITONSHELL_MANTA_DOMAIN
|
|
|
|
tritonApiDomain=$TRITONSHELL_TRITON_API_DOMAIN
|
2022-03-02 23:34:18 +00:00
|
|
|
|
2022-10-12 11:01:33 +00:00
|
|
|
# Set triton and docker host environment variables
|
|
|
|
eval "$(${triton}/bin/triton env)"
|
2022-03-02 23:34:18 +00:00
|
|
|
|
2022-10-12 11:01:33 +00:00
|
|
|
# Get the user's UUID
|
|
|
|
triton_account_uuid="$(${triton}/bin/triton account get --json | ${json}/bin/json id)"
|
2022-03-02 23:34:18 +00:00
|
|
|
|
2022-10-12 11:01:33 +00:00
|
|
|
# Set the CNS (container name service) base domain for auto-generated DNS
|
|
|
|
# records in public and private networks
|
|
|
|
# Note: the defaults are configured to work with our data centers, adjust the
|
|
|
|
# nix module options like config.environment.cnsBaseDomain in your devshell
|
|
|
|
# if you'd like to use tritonshell with your own, self-hosted TritonDataCenter
|
|
|
|
for dc in "''${dataCenters[@]}"; do
|
|
|
|
if env | grep -q -E "SDC_URL=https://''${dc}.''${tritonApiDomain}"; then
|
2022-06-09 12:29:45 +00:00
|
|
|
export \
|
2022-10-12 11:01:33 +00:00
|
|
|
TRITON_CNS_SEARCH_DOMAIN_PUBLIC="''${triton_account_uuid}.''${dc}.''${cnsBaseDomain}" \
|
|
|
|
TRITON_CNS_SEARCH_DOMAIN_PRIVATE="''${triton_account_uuid}.''${dc}.int.''${cnsBaseDomain}" \
|
2022-06-09 12:29:45 +00:00
|
|
|
TRITON_DC=''$dc
|
|
|
|
fi
|
|
|
|
done
|
2022-03-02 23:34:18 +00:00
|
|
|
|
2022-10-12 11:01:33 +00:00
|
|
|
export MANTA_URL=https://''${mantaDomain}
|
2022-06-09 12:29:45 +00:00
|
|
|
export MANTA_USER=$SDC_ACCOUNT
|
|
|
|
export MANTA_KEY_ID=$SDC_KEY_ID
|
2022-03-02 23:34:18 +00:00
|
|
|
''
|