-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
57 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
*.dll | ||
*.so | ||
*.dylib | ||
app-*.yaml | ||
|
||
# Test binary, build with `go test -c` | ||
*.test | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
application: | ||
runtime: | ||
api_version: go1.8 | ||
version: 1 | ||
module: commenting | ||
|
||
threadsafe: true | ||
|
||
handlers: | ||
- url: /_ah/push-handlers/.* | ||
script: main.APPLICATION | ||
login: admin | ||
- url: /.* | ||
script: _go_app | ||
secure: always | ||
|
||
env_variables: | ||
APP_ID: | ||
SERVICE_ACCOUNT_PATH: | ||
IS_PRODUCTION: | ||
GOOGLE_APPLICATION_CREDENTIALS: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
application: | ||
runtime: go | ||
api_version: go1.8 | ||
version: 1 | ||
module: notification | ||
|
||
threadsafe: true | ||
|
||
handlers: | ||
- url: /_ah/push-handlers/.* | ||
script: main.APPLICATION | ||
login: admin | ||
- url: /.* | ||
script: _go_app | ||
secure: always | ||
|
||
env_variables: | ||
APP_ID: | ||
SERVICE_ACCOUNT_PATH: | ||
IS_PRODUCTION: | ||
GOOGLE_APPLICATION_CREDENTIALS: | ||
ADMIN_EMAIL: | ||
SENDER_EMAIL: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,30 @@ | ||
package env | ||
|
||
import ( | ||
"google.golang.org/api/option" | ||
"os" | ||
"path/filepath" | ||
"time" | ||
) | ||
|
||
// application globals | ||
// アプリにとって普遍とみなせる値や関数、環境変数など? | ||
// どこからでも使われるような値や概念はRepositoryにするよりグローバル変数にしてしまったほうが楽そう | ||
var Namespace string | ||
var CurrentTime func() time.Time | ||
var IsProduction bool | ||
var GCPCredentialOption option.ClientOption | ||
var ProjectID string | ||
var AdminEmail string | ||
var SenderEmail string | ||
|
||
func init() { | ||
ProjectID = os.Getenv("APP_ID") | ||
|
||
IsProduction = os.Getenv("IS_PRODUCTION") == "True" | ||
|
||
// time | ||
CurrentTime = time.Now | ||
AdminEmail = os.Getenv("ADMIN_EMAIL") | ||
SenderEmail = os.Getenv("SENDER_EMAIL") | ||
|
||
// namespace | ||
if ns := os.Getenv("NAMESPACE"); ns != "" { | ||
Namespace = ns | ||
} else { | ||
Namespace = "" | ||
} | ||
|
||
path, err := filepath.Abs(os.Getenv("SERVICE_ACCOUNT_PATH")) | ||
if err != nil { | ||
panic(err.Error()) | ||
} | ||
GCPCredentialOption = option.WithCredentialsFile(path) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters