This repository has been archived by the owner on Oct 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented APIKeys, as well as getting to conform to check style
- Loading branch information
Showing
20 changed files
with
650 additions
and
88 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 |
---|---|---|
|
@@ -20,3 +20,6 @@ reports/ | |
|
||
# Local database files | ||
*.db | ||
|
||
# YAML | ||
*.yaml |
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
3 changes: 1 addition & 2 deletions
3
api/src/test/java/com/mainstreethub/project/TestUserSerialization.java
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,51 @@ | ||
# This is the development configuration for the Demo Application. | ||
# The actual production and test configs are generated at deployment time. | ||
# Make sure to update deployment configs in the ops repo when updating the | ||
# Configuration class. Make | ||
|
||
database: | ||
# the name of your JDBC driver | ||
driverClass: com.mysql.jdbc.Driver | ||
|
||
# the username - Make a copy of this file and change the value for dev work but don't check it in | ||
user: CHANGEME | ||
|
||
# the password - Make a copy of this file and change the value for dev work but don't check it in | ||
password: CHANGEMETOO | ||
|
||
# the JDBC URL | ||
url: jdbc:mysql://CHANGEMETHREE | ||
|
||
# the maximum amount of time to wait on an empty pool before throwing an exception | ||
maxWaitForConnection: 1s | ||
|
||
# the SQL query to run when validating a connection's liveness | ||
validationQuery: "/* Demo Health Check */ SELECT 1" | ||
|
||
# the timeout before a connection validation queries fail | ||
validationQueryTimeout: 3s | ||
|
||
# the minimum number of connections to keep open | ||
minSize: 8 | ||
|
||
# the maximum number of connections to keep open | ||
maxSize: 32 | ||
|
||
# whether or not idle connections should be validated | ||
checkConnectionWhileIdle: false | ||
|
||
# the amount of time to sleep between runs of the idle connection validation, abandoned cleaner and idle pool resizing | ||
evictionInterval: 10s | ||
|
||
# the minimum amount of time an connection must sit idle in the pool before it is eligible for eviction | ||
minIdleTime: 1 minute | ||
|
||
# whether or not connections will be validated before being borrowed from the pool | ||
checkConnectionOnBorrow: true | ||
|
||
authentication: | ||
basic-http: | ||
cache-spec: maximumSize=1000, expireAfterAccess=10m | ||
realm: ProjectApplication | ||
keys: | ||
testKey: CHANGEME |
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
22 changes: 11 additions & 11 deletions
22
application/src/main/java/com/mainstreethub/project/ProjectApplication.java
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,38 +1,38 @@ | ||
package com.mainstreethub.project; | ||
|
||
import com.mainstreethub.project.dao.JDBIModule; | ||
import com.mainstreethub.project.dao.JdbiModule; | ||
|
||
import io.dropwizard.Application; | ||
import io.dropwizard.setup.Bootstrap; | ||
import io.dropwizard.setup.Environment; | ||
import io.dropwizard.bundles.apikey.ApiKeyBundle; | ||
import io.dropwizard.bundles.version.VersionBundle; | ||
import io.dropwizard.bundles.version.VersionSupplier; | ||
import io.dropwizard.bundles.version.suppliers.MavenVersionSupplier; | ||
import io.dropwizard.setup.Bootstrap; | ||
import io.dropwizard.setup.Environment; | ||
|
||
|
||
public class ProjectApplication extends Application<ProjectConfiguration> { | ||
public static void main(String[] args) throws Exception { | ||
new ProjectApplication().run(args); | ||
} | ||
|
||
|
||
@Override | ||
public void initialize(Bootstrap<ProjectConfiguration> bootstrap) { | ||
initVersion(bootstrap); | ||
initVersion(bootstrap); | ||
bootstrap.addBundle(new ApiKeyBundle<ProjectConfiguration>()); | ||
} | ||
|
||
@Override | ||
public void run(ProjectConfiguration configuration, Environment environment) throws Exception { | ||
ProjectComponent component = DaggerProjectComponent.builder() | ||
.jDBIModule(new JDBIModule(configuration.getDatabase(), environment)) | ||
.projectModule(new ProjectModule()) | ||
.build(); | ||
|
||
.jdbiModule(new JdbiModule(configuration.getDatabase(), environment)) | ||
.projectModule(new ProjectModule()) | ||
.build(); | ||
environment.jersey().register(component.getUsersResource()); | ||
} | ||
|
||
private void initVersion(Bootstrap<ProjectConfiguration> bootstrap) { | ||
VersionSupplier supplier = new MavenVersionSupplier("com.mainstreethub.project", "application"); | ||
bootstrap.addBundle(new VersionBundle(supplier)); | ||
VersionSupplier supplier = new MavenVersionSupplier("com.mainstreethub.project", "application"); | ||
bootstrap.addBundle(new VersionBundle(supplier)); | ||
} | ||
} |
6 changes: 3 additions & 3 deletions
6
application/src/main/java/com/mainstreethub/project/ProjectComponent.java
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,12 +1,12 @@ | ||
package com.mainstreethub.project; | ||
|
||
import com.mainstreethub.project.dao.JDBIModule; | ||
import com.mainstreethub.project.resources.UsersResource; | ||
import com.mainstreethub.project.dao.JdbiModule; | ||
import com.mainstreethub.project.resources.v1.UsersResource; | ||
import dagger.Component; | ||
import javax.inject.Singleton; | ||
|
||
@Singleton | ||
@Component(modules = {JDBIModule.class, ProjectModule.class}) | ||
@Component(modules = {JdbiModule.class, ProjectModule.class}) | ||
public interface ProjectComponent { | ||
UsersResource getUsersResource(); | ||
} |
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
Oops, something went wrong.