File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
src/main/java/com/example/cloudsql Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change 3
3
## Before you begin
4
4
5
5
1 . If you haven't already, set up a Java Development Environment (including google-cloud-sdk and
6
- maven utilities) by following the [ java setup guide] ( https://cloud.google.com/java/docs/setup ) .
6
+ maven utilities) by following the [ java setup guide] ( https://cloud.google.com/java/docs/setup ) and
7
+ [ create a project] ( https://cloud.google.com/resource-manager/docs/creating-managing-projects#creating_a_project ) .
7
8
8
9
1 . Create a 2nd Gen Cloud SQL Instance by following these
9
10
[ instructions] ( https://cloud.google.com/sql/docs/mysql/create-instance ) . Note the connection string,
@@ -25,6 +26,8 @@ export DB_USER='my-db-user'
25
26
export DB_PASS=' my-db-pass'
26
27
export DB_NAME=' my_db'
27
28
```
29
+ Note: Saving credentials in environment variables is convenient, but not secure - consider a more
30
+ secure solution such as [ Cloud KMS] ( https://cloud.google.com/kms/ ) to help keep secrets safe.
28
31
29
32
## Deploying locally
30
33
@@ -40,7 +43,9 @@ Navigate towards `http://127.0.0.1:8080` to verify your application is running c
40
43
41
44
To run on GAE-Standard, create an AppEngine project by following the setup for these
42
45
[ instructions] ( https://cloud.google.com/appengine/docs/standard/java/quickstart#before-you-begin )
43
- and verify that ` appengine-api-1.0-sdk ` is listed as a dependency in the pom.xml.
46
+ and verify that
47
+ [ appengine-maven-plugin] ( https://cloud.google.com/java/docs/setup#optional_install_maven_or_gradle_plugin_for_app_engine )
48
+ has been added in your build section as a plugin.
44
49
45
50
46
51
### Development Server
Original file line number Diff line number Diff line change 29
29
@ WebListener ("Creates a connection pool that is stored in the Servlet's context for later use." )
30
30
public class ConnectionPoolContextListener implements ServletContextListener {
31
31
32
+ // Saving credentials in environment variables is convenient, but not secure - consider a more
33
+ // secure solution such as https://cloud.google.com/kms/ to help keep secrets safe.
32
34
private static final String CLOUD_SQL_INSTANCE_NAME = System .getenv ("CLOUD_SQL_INSTANCE_NAME" );
33
35
private static final String DB_USER = System .getenv ("DB_USER" );
34
36
private static final String DB_PASS = System .getenv ("DB_PASS" );
You can’t perform that action at this time.
0 commit comments