New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: #12 Add GCS File Upload #42
Conversation
|
||
config :materia, bucket_id: System.get_env("BUCKET_ID") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bucketは環境変数
@@ -64,4 +64,7 @@ config :materia, Materia.Accounts, | |||
config :materia, Materia.Plug.ApplicationKeyChecker, | |||
app_key: "test_app_key" | |||
|
|||
config :goth, config_module: Materia.Files.GoogleCloudPlatformConfigStub | |||
#config :goth, config_module: Materia.Files.GoogleCloudPlatformConfig |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GoogleCloudPlatformConfigStub
→ Goth起動に最低限必要な空定義を設定。
GoogleCloudPlatformConfig
→ 本格利用する場合にはこっちを設定。 定義ファイルの場所は環境変数から取る。
def init(config) do | ||
{:ok, Keyword.put(config, :json, System.get_env("GCP_JSON_CREDENTIALS") |> File.read!)} | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GCP_JSON_CREDENTIALS の環境変数にファイルパスを記載。
ここは, 各プロジェクトから参照出来る箇所じゃないとだめ。
例: GCP_JSON_CREDENTIALS=config/test_credential.json
) | ||
{:ok, Keyword.put(config, :json, json)} | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gothの起動に必要最低限なJson値
"jose": {:hex, :jose, "1.8.4", "7946d1e5c03a76ac9ef42a6e6a20001d35987afd68c2107bcd8f01a84e75aa73", [:mix, :rebar3], [{:base64url, "~> 0.0.1", [hex: :base64url, repo: "hexpm", optional: false]}], "hexpm"}, | ||
"materia_utils": {:git, "https://github.com/karabiner-inc/materia_utils.git", "f8414a32748ca5b04dc51a8622d2dd34f8dd792a", []}, | ||
"materia_utils": {:git, "https://github.com/karabiner-inc/materia_utils.git", "d512cdafd34a169915bb0da42478caf0e4433fa6", []}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
最新のUtilに変更
GoogleCloudStorageのファイルアップロード機能を移植しました。
各エンドポイントのアップロード結果は, GCSを参照願います。
upload-file-private
https://console.cloud.google.com/storage/browser/d3-develop/32d7c5a6-b250-4b57-bb62-8a370c74dd50?project=mike-230815
upload-file-public
https://console.cloud.google.com/storage/browser/d3-develop/96f97e7b-a76a-4bdc-921b-4921591ebb42?project=mike-230815