<commit_before># Berglas

[![Build Status](https://img.shields.io/travis/com/GoogleCloudPlatform/berglas/master.svg?style=flat-square)](https://travis-ci.com/GoogleCloudPlatform/berglas)
[![GoDoc](https://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)][berglas-godoc]

![Berglas Logo](/logos/berglas.svg)

Berglas is a command line tool and library for storing and and retrieving
secrets on Google Cloud. Secrets are encrypted with [Cloud KMS][cloud-kms] and
stored in [Cloud Storage][cloud-storage].

- As a **CLI**, `berglas` automates the process of encrypting, decrypting, and
  storing data on Google Cloud.

- As a **library**, `berglas` automates the inclusion of secrets into various
  Google Cloud runtimes

**Berglas is not an officially supported Google product.**


## Setup

1. Install the [Cloud SDK][cloud-sdk] for your operating system. Alternatively,
   you can run these commands from [Cloud Shell][cloud-shell], which has the SDK
   and other popular tools pre-installed.

    If you are running from your local machine, you also need Default
    Application Credentials:

    ```text
    gcloud auth application-default login
    ```

    This will open a web browser and prompt for a login to your Google account.
    On headless devices, you will need to create a service account. For more
    information, please see the [authentication](#authentication) section.

1. Install the `berglas` CLI using **one** of the following methods:

    - Install a pre-compiled binary for your operating system:

        - [darwin/amd64](https://storage.googleapis.com/berglas/master/darwin_amd64/berglas)
        - [linux/amd64](https://storage.googleapis.com/berglas/master/linux_amd64/berglas)
        - [windows/amd64](https://storage.googleapis.com/berglas/master/windows_amd64/berglas)

      This will download the latest version built against the master branch. To
      download a specific version, specify a git tag in place of "master" in the
      URL.

    - Use the official Docker container:

      ```text
      docker pull gcr.io/berglas/berglas:latest
      ```

      This will pull the latest version built against the master branch. To use
      a specific version, specify a git tag in place of "latest" in the URL.

    - Install from source (requires a working Go installation):

      ```text
      go get github.com/GoogleCloudPlatform/berglas/...
      go install github.com/GoogleCloudPlatform/berglas
      ```

1. Export your project ID as an environment variable. The rest of this setup
   guide assumes this environment variable is set:

    ```text
    export PROJECT_ID=my-gcp-project-id
    ```

    Please note, this is the project _ID_, not the project _name_ or project
    _number_. You can find the project ID by running `gcloud projects list` or
    in the web UI.

1. Export your desired Cloud Storage bucket name. The rest of this setup guide
   assumes this environment variable is set:


    ```text
    export BUCKET_ID=my-secrets
    ```

    Replace `my-secrets` with the name of your bucket. **This bucket should not
    exist yet!**

1. Bootstrap a Berglas environment. This will create a new Cloud Storage bucket
   for storing secrets and a Cloud KMS key for encrypting data.


    ```text
    berglas bootstrap --project $PROJECT_ID --bucket $BUCKET_ID
    ```

    This command uses the default values. You can customize the storage bucket
    and KMS key configuration using the optional flags. Run `berglas bootstrap
    -h` for more details.
<commit_msg>Enable APIs<commit_after># Berglas

[![Build Status](https://img.shields.io/travis/com/GoogleCloudPlatform/berglas/master.svg?style=flat-square)](https://travis-ci.com/GoogleCloudPlatform/berglas)
[![GoDoc](https://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)][berglas-godoc]

![Berglas Logo](/logos/berglas.svg)

Berglas is a command line tool and library for storing and and retrieving
secrets on Google Cloud. Secrets are encrypted with [Cloud KMS][cloud-kms] and
stored in [Cloud Storage][cloud-storage].

- As a **CLI**, `berglas` automates the process of encrypting, decrypting, and
  storing data on Google Cloud.

- As a **library**, `berglas` automates the inclusion of secrets into various
  Google Cloud runtimes

**Berglas is not an officially supported Google product.**


## Setup

1. Install the [Cloud SDK][cloud-sdk] for your operating system. Alternatively,
   you can run these commands from [Cloud Shell][cloud-shell], which has the SDK
   and other popular tools pre-installed.

    If you are running from your local machine, you also need Default
    Application Credentials:

    ```text
    gcloud auth application-default login
    ```

    This will open a web browser and prompt for a login to your Google account.
    On headless devices, you will need to create a service account. For more
    information, please see the [authentication](#authentication) section.

1. Install the `berglas` CLI using **one** of the following methods:

    - Install a pre-compiled binary for your operating system:

        - [darwin/amd64](https://storage.googleapis.com/berglas/master/darwin_amd64/berglas)
        - [linux/amd64](https://storage.googleapis.com/berglas/master/linux_amd64/berglas)
        - [windows/amd64](https://storage.googleapis.com/berglas/master/windows_amd64/berglas)

      This will download the latest version built against the master branch. To
      download a specific version, specify a git tag in place of "master" in the
      URL.

    - Use the official Docker container:

      ```text
      docker pull gcr.io/berglas/berglas:latest
      ```

      This will pull the latest version built against the master branch. To use
      a specific version, specify a git tag in place of "latest" in the URL.

    - Install from source (requires a working Go installation):

      ```text
      go get github.com/GoogleCloudPlatform/berglas/...
      go install github.com/GoogleCloudPlatform/berglas
      ```

1. Export your project ID as an environment variable. The rest of this setup
   guide assumes this environment variable is set:

    ```text
    export PROJECT_ID=my-gcp-project-id
    ```

    Please note, this is the project _ID_, not the project _name_ or project
    _number_. You can find the project ID by running `gcloud projects list` or
    in the web UI.

1. Export your desired Cloud Storage bucket name. The rest of this setup guide
   assumes this environment variable is set:


    ```text
    export BUCKET_ID=my-secrets
    ```

    Replace `my-secrets` with the name of your bucket. **This bucket should not
    exist yet!**

1. Enable required services on the project:

    ```text
    gcloud services enable --project ${PROJECT_ID} \
      cloudkms.googleapis.com \
      storage-api.googleapis.com \
      storage-component.googleapis.com
    ```

1. Bootstrap a Berglas environment. This will create a new Cloud Storage bucket
   for storing secrets and a Cloud KMS key for encrypting data.


    ```text
    berglas bootstrap --project $PROJECT_ID --bucket $BUCKET_ID
    ```

    This command uses the default values. You can customize the storage bucket
    and KMS key configuration using the optional flags. Run `berglas bootstrap
    -h` for more details.

{'fraction_non_alphanumeric': 0.08437200383509108, 'fraction_numerical': 0.004793863854266539, 'mean_word_length': 3.372455089820359, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 12, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '36516', 'n_tokens_mistral': 2083, 'n_tokens_neox': 2007, 'n_words': 823}