-
Notifications
You must be signed in to change notification settings - Fork 0
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
[Flutter] API Keyなどの秘匿情報の管理 #32
Changes from all commits
a51edf6
3f2f971
d6d882f
939d749
2ad54f4
ef688ec
321e937
d218a8c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"recommendations": [ | ||
"Dart-Code.flutter", // Flutter support and debugger for Visual Studio Code. | ||
"Dart-Code.dart-code", // Dart | ||
"robert-brunhage.flutter-riverpod-snippets", // riverpod | ||
// "alexisvt.flutter-snippets", // flutter widget snippets | ||
] | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://de-milestones.com/vscode-how-to-setup-recommended-tools/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{ | ||
// IntelliSense を使用して利用可能な属性を学べます。 | ||
// 既存の属性の説明をホバーして表示します。 | ||
// 詳細情報は次を確認してください: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
// launch.json作成時のテンプレート - START | ||
// "configurations": [ | ||
// { | ||
// "name": "flutter_github_search", | ||
// "request": "launch", | ||
// "type": "dart" | ||
// }, | ||
// { | ||
// "name": "flutter_github_search (profile mode)", | ||
// "request": "launch", | ||
// "type": "dart", | ||
// "flutterMode": "profile" | ||
// }, | ||
// { | ||
// "name": "flutter_github_search (release mode)", | ||
// "request": "launch", | ||
// "type": "dart", | ||
// "flutterMode": "release" | ||
// } | ||
// ] | ||
// launch.json作成時のテンプレート - END | ||
"configurations": [ | ||
{ | ||
"name": "Debug dev", | ||
"request": "launch", | ||
"type": "dart", | ||
"flutterMode": "debug", | ||
"args": [ | ||
"--dart-define-from-file=dart_define/development.json" | ||
] | ||
}, | ||
{ | ||
"name": "Debug stg", | ||
"request": "launch", | ||
"type": "dart", | ||
"flutterMode": "debug", | ||
"args": [ | ||
"--dart-define-from-file=dart_define/staging.json" | ||
] | ||
}, | ||
{ | ||
"name": "Debug prod", | ||
"request": "launch", | ||
"type": "dart", | ||
"flutterMode": "debug", | ||
"args": [ | ||
"--dart-define-from-file=dart_define/production.json" | ||
] | ||
} | ||
] | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. vscode上で、「実行とデバッグ」をクリックして実行する場合に指定できるビルドタイプの設定ファイル |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
{ | ||
// Flutterプロジェクトのバージョン管理のため、fvmを指定 -START | ||
// https://fvm.app/docs/getting_started/configuration#option-1---automatic-switching-recommended | ||
"dart.flutterSdkPath": ".fvm/flutter_sdk", | ||
// Remove .fvm files from search | ||
"search.exclude": { | ||
"**/.fvm": true | ||
}, | ||
// Remove from file watching | ||
"files.watcherExclude": { | ||
"**/.fvm": true | ||
}, | ||
// Flutterプロジェクトのバージョン管理のため、fvmを指定 -END | ||
"[dart]": { | ||
// Automatically format code on save and during typing of certain characters | ||
// (like `;` and `}`). | ||
"editor.formatOnSave": true, | ||
"editor.formatOnType": true, | ||
// Draw a guide line at 80 characters, where Dart's formatting will wrap code. | ||
"editor.rulers": [ | ||
80 | ||
], | ||
// Disables built-in highlighting of words that match your selection. Without | ||
// this, all instances of the selected text will be highlighted, interfering | ||
// with Dart's ability to highlight only exact references to the selected variable. | ||
"editor.selectionHighlight": false, | ||
// By default, VS Code prevents code completion from popping open when in | ||
// "snippet mode" (editing placeholders in inserted code). Setting this option | ||
// to `false` stops that and allows completion to open as normal, as if you | ||
// weren't in a snippet placeholder. | ||
"editor.suggest.snippetsPreventQuickSuggestions": false, | ||
// By default, VS Code will pre-select the most recently used item from code | ||
// completion. This is usually not the most relevant item. | ||
// | ||
// "first" will always select top item | ||
// "recentlyUsedByPrefix" will filter the recently used items based on the | ||
// text immediately preceding where completion was invoked. | ||
"editor.suggestSelection": "first", | ||
// Allows pressing <TAB> to complete snippets such as `for` even when the | ||
// completion list is not visible. | ||
"editor.tabCompletion": "onlySnippets", | ||
// By default, VS Code will populate code completion with words found in the | ||
// current file when a language service does not provide its own completions. | ||
// This results in code completion suggesting words when editing comments and | ||
// strings. This setting will prevent that. | ||
"editor.wordBasedSuggestions": false, | ||
}, | ||
"dart.openDevTools": "flutter", | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Editorの設定やflutter fvmの設定周りの共有用の設定ファイル |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"flavor": "development", | ||
"flutterAppName": "(Dev)GithubSearch", | ||
"flutterApplicationIdSuffix": ".development", | ||
"githubAccessToken": "", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 秘匿情報はここの設定値をローカル環境にて各自書き換える。 |
||
"githubApiDomain": "api.github.com" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"flavor": "production", | ||
"flutterAppName": "GithubSearch", | ||
"flutterApplicationIdSuffix": "", | ||
"githubAccessToken": "", | ||
"githubApiDomain": "api.github.com" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"flavor": "staging", | ||
"flutterAppName": "(Stg)GithubSearch", | ||
"flutterApplicationIdSuffix": ".staging", | ||
"githubAccessToken": "", | ||
"githubApiDomain": "api.github.com" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ final Provider githubApiProvider = Provider<GithubApi>((_) { | |
}); | ||
|
||
class GithubApi { | ||
static const _authority = 'api.github.com'; | ||
static const _authority = String.fromEnvironment('githubApiDomain'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
static const perPage = 20; | ||
final client = GithubApiHttpClient(); | ||
Future<SearchRepositoriesResponse> searchRepositories( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,10 +10,11 @@ import 'package:flutter_github_search/data/api/http_handler.dart'; | |
import 'package:flutter_github_search/domain/exception/api_exceptions.dart'; | ||
|
||
class GithubApiHttpClient extends http.BaseClient { | ||
// static const String _accessToken = "INPUT HERE TOKEN"; | ||
static const String _accessToken = | ||
String.fromEnvironment('githubAccessToken'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
final Map<String, String> _headers = <String, String>{ | ||
'Accept': 'application/vnd.github.v3+json', | ||
// 'Authorization': 'Bearer $_accessToken', | ||
'Authorization': 'Bearer $_accessToken', | ||
'X-GitHub-Api-Version': '2022-11-28', | ||
}; | ||
final http.Client _client = http.Client(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Flutter imports: | ||
import 'package:flutter/material.dart'; | ||
|
||
class EnvironmentVariableScreen extends StatelessWidget { | ||
const EnvironmentVariableScreen({super.key}); | ||
@override | ||
Widget build(BuildContext context) { | ||
const flavor = String.fromEnvironment('flavor'); | ||
const appName = String.fromEnvironment('flutterAppName'); | ||
const applicationIdSuffix = | ||
String.fromEnvironment('flutterApplicationIdSuffix'); | ||
const githubAccessToken = String.fromEnvironment('githubAccessToken'); | ||
const githubApiDomain = String.fromEnvironment('githubApiDomain'); | ||
return Scaffold( | ||
appBar: AppBar( | ||
title: const Text('Env Variable'), | ||
), | ||
body: SafeArea( | ||
child: SingleChildScrollView( | ||
child: Column( | ||
children: const [ | ||
ListTile( | ||
leading: Text('flavor'), | ||
title: Text(flavor), | ||
), | ||
ListTile( | ||
leading: Text('appName'), | ||
title: Text(appName), | ||
), | ||
ListTile( | ||
leading: Text('applicationIdSuffix'), | ||
title: Text(applicationIdSuffix), | ||
), | ||
ListTile( | ||
leading: Text('githubAccessToken'), | ||
title: Text(githubAccessToken), | ||
), | ||
ListTile( | ||
leading: Text('githubApiDomain'), | ||
title: Text(githubApiDomain), | ||
), | ||
], | ||
), | ||
)), | ||
); | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 環境変数確認用画面 |
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.
チーム内で開発環境を統一するために必要なjsonファイルのみgit管理対象にする