Bluemixを登録して適当に作成。
そのあと、
https://github.com/IBM-Swift/Kitura-Starter-Bluemix
ここでボタンを押下したらできた。
さらに待つと、
右下の「EDIT CODE」から編集ができる。
左下の「VIEW YOUR APP」で現在のKituraのアプリが見える。
/hello
をつけて
http://hogehoge/hello
/json
をつけて
http://hogehoge/json
しかしローカルで編集したい。
コマンドラインのツール。
gitリポジトリは?
ここから辿れる IDS(IBM DevOps Servicesの略)の機能の一つ? https://hub.jazz.net/
↓これ
そっからリポジトリのurlをコピーし
git clone https://hub.jazz.net/git/ユーザ名/アプリ名
でいけた。 ユーザ名は、メールアドレス、パスワードはbluemixのと同じだった。
Bluemixで使えるcf
コマンドのインストーラ(Macもある)
https://github.com/cloudfoundry/cli/releases
環境設定の設定コマンド(コマンド)
Cloud Foundry Environment Variables | Pivotal Web Services Docs
cfコマンドの最初のログインが詳しい
cf a
コマンドでアプリ一覧
僕はshinriyoincスペースにlinebotアプリ
cf a Getting apps in org shinriyoinc / space linebot as shinriyo@gmail.com... OK name requested state instances memory disk urls Kitura-Starter-Bluemix-shinriyo-156 started 1/1 256M 1G Kitura-Starter-Bluemix-shinriyo-156.mybluemix.net
環境変数はcf env アプリ名
で確認
てっきり、linebotと思ってcf env linebot
としたがそれではなく、その下に出てたnameにあったKitura-Starter-Bluemix-shinriyo-156
であった。
cf env Kitura-Starter-Bluemix-shinriyo-156 Getting env variables for app Kitura-Starter-Bluemix-shinriyo-156 in org shinriyoinc / space linebot as ## DNSの設定 [http://dotnsf.blog.jp/archives/1018861460.html:embed:cite] ## 環境変数をKituraでというかSwiftでは
import Foundation
let env = NSProcessInfo.processInfo().environment
if let channel_id_value = env["LINE_CHANNEL_ID"] as? String {
print(channel_id_value) //=> 1234
response.headers["X-Line-ChannelID"] = channel_id_value
} else {
// Environment variable not set (or not a string)
print("No LINE_CHANNEL_ID")
}
`NSProcessInfo`のNSは消えた。 ・・・が、どうやる? [https://thatthinginswift.com/automatic-migration-to-swift-3-with-xcode/:title] ここにあった。
let env = ProcessInfo.processInfo.environment
になるのね