1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

.envファイルを作成するshell scripts

Last updated at Posted at 2021-04-04
#!/bin/bash

function SettingExecution() {
    echo "ビルドに必要な環境情報を入力してください。"

    read -p 'Contentful Space ID: ' CTF_SPACE_ID
    read -p 'Contentful Content Delivery API - access token: ' CTF_CDA_ACCESS_TOKEN
    read -p 'Contentful Content Preview API - access token: ' CTF_CDA_ACCESS_TOKEN_PREVIEW

    if [ -n "$CTF_SPACE_ID" -a -n "$CTF_CDA_ACCESS_TOKEN" -a -n "$CTF_CDA_ACCESS_TOKEN_PREVIEW" ]; then
        {
            echo "CTF_SPACE_ID=$CTF_SPACE_ID"
            echo "CTF_CDA_ACCESS_TOKEN=$CTF_CDA_ACCESS_TOKEN"
            echo "CTF_CDA_ACCESS_TOKEN_PREVIEW=$CTF_CDA_ACCESS_TOKEN_PREVIEW"
        } > .env
        echo "入力された内容で.envファイルを作成しました。"
    else
        echo "入力された値が不足しています。"
        echo "スクリプトを終了します。"
        exit 1
    fi
}

SettingExecution
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?