-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integration of Supabase-Spring Auth. | PostgreSQL as VectorDB/History…
…Context | HikariCP For PostgreSQL (#152) * Integration of Supabase-Spring Auth. | PostgreSQL as VectorDB/HistoryContext | Connection Pooling For DataSource * Adding Cors Configuration | Fixing Issues * Adding Cors Configuration | Fixing Issues * Adding Cors Configuration | Fixing Issues * Updated EdgeChainApplication
- Loading branch information
1 parent
d97ecfb
commit e799280
Showing
97 changed files
with
1,932 additions
and
1,845 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
35 changes: 35 additions & 0 deletions
35
.../edgechain-app/src/main/java/com/edgechain/lib/configuration/PostgreSQLConfiguration.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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.edgechain.lib.configuration; | ||
|
||
import com.edgechain.lib.configuration.domain.SupabaseEnv; | ||
import com.zaxxer.hikari.HikariDataSource; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.jdbc.DataSourceBuilder; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.jdbc.core.JdbcTemplate; | ||
|
||
@Configuration | ||
public class PostgreSQLConfiguration { | ||
|
||
@Autowired private SupabaseEnv supabaseEnv; | ||
|
||
@Bean | ||
public HikariDataSource dataSource() { | ||
|
||
HikariDataSource hikariDataSource = | ||
DataSourceBuilder.create() | ||
.type(HikariDataSource.class) | ||
.url(supabaseEnv.getDbHost()) | ||
.driverClassName("org.postgresql.Driver") | ||
.username(supabaseEnv.getDbUsername()) | ||
.password(supabaseEnv.getDbPassword()) | ||
.build(); | ||
|
||
return hikariDataSource; | ||
} | ||
|
||
@Bean | ||
public JdbcTemplate jdbcTemplate() { | ||
return new JdbcTemplate(dataSource()); | ||
} | ||
} |
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
45 changes: 43 additions & 2 deletions
45
FlySpring/edgechain-app/src/main/java/com/edgechain/lib/configuration/WebConfiguration.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,11 +1,52 @@ | ||
package com.edgechain.lib.configuration; | ||
|
||
import com.edgechain.lib.configuration.domain.*; | ||
import org.modelmapper.ModelMapper; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.Import; | ||
import org.springframework.core.Ordered; | ||
import org.springframework.core.annotation.Order; | ||
import org.springframework.web.client.RestTemplate; | ||
|
||
import java.util.UUID; | ||
|
||
@Order(Ordered.HIGHEST_PRECEDENCE) | ||
@Configuration("WebConfiguration") | ||
@Import(EdgeChainAutoConfiguration.class) | ||
public class WebConfiguration {} | ||
public class WebConfiguration { | ||
|
||
@Bean | ||
public ModelMapper modelMapper() { | ||
return new ModelMapper(); | ||
} | ||
|
||
@Bean | ||
public RestTemplate restTemplate() { | ||
return new RestTemplate(); | ||
} | ||
|
||
@Bean | ||
public SupabaseEnv supabaseEnv() { | ||
return new SupabaseEnv(); | ||
} | ||
|
||
@Bean | ||
public RedisEnv redisEnv() { | ||
return new RedisEnv(); | ||
} | ||
|
||
@Bean | ||
public ExcludeMappingFilter mappingFilter() { | ||
return new ExcludeMappingFilter(); | ||
} | ||
|
||
@Bean | ||
public SecurityUUID securityUUID() { | ||
return new SecurityUUID(UUID.randomUUID().toString()); | ||
} | ||
|
||
@Bean | ||
public CorsEnableOrigins corsEnableOrigins() { | ||
return new CorsEnableOrigins(); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...edgechain-app/src/main/java/com/edgechain/lib/configuration/domain/CorsEnableOrigins.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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.edgechain.lib.configuration.domain; | ||
|
||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.List; | ||
|
||
@Component | ||
public class CorsEnableOrigins { | ||
|
||
List<String> origins; | ||
|
||
public List<String> getOrigins() { | ||
return origins; | ||
} | ||
|
||
public void setOrigins(List<String> origins) { | ||
this.origins = origins; | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
...echain-app/src/main/java/com/edgechain/lib/configuration/domain/ExcludeMappingFilter.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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package com.edgechain.lib.configuration.domain; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class ExcludeMappingFilter { | ||
|
||
private List<String> requestGet = new ArrayList<>(); | ||
private List<String> requestPost = new ArrayList<>(); | ||
|
||
private List<String> requestPut = new ArrayList<>(); | ||
|
||
private List<String> requestPatch = new ArrayList<>(); | ||
|
||
private List<String> requestDelete = new ArrayList<>(); | ||
|
||
public String[] getRequestGet() { | ||
return requestGet.toArray(String[]::new); | ||
} | ||
|
||
public void setRequestGet(List<String> requestGet) { | ||
this.requestGet = requestGet; | ||
} | ||
|
||
public String[] getRequestPost() { | ||
return requestPost.toArray(String[]::new); | ||
} | ||
|
||
public void setRequestPost(List<String> requestPost) { | ||
this.requestPost = requestPost; | ||
} | ||
|
||
public String[] getRequestPut() { | ||
return requestPut.toArray(String[]::new); | ||
} | ||
|
||
public void setRequestPut(List<String> requestPut) { | ||
this.requestPut = requestPut; | ||
} | ||
|
||
public String[] getRequestPatch() { | ||
return requestPatch.toArray(String[]::new); | ||
} | ||
|
||
public void setRequestPatch(List<String> requestPatch) { | ||
this.requestPatch = requestPatch; | ||
} | ||
|
||
public String[] getRequestDelete() { | ||
return requestDelete.toArray(String[]::new); | ||
} | ||
|
||
public void setRequestDelete(List<String> requestDelete) { | ||
this.requestDelete = requestDelete; | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...edgechain/lib/configuration/RedisEnv.java → ...in/lib/configuration/domain/RedisEnv.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
18 changes: 18 additions & 0 deletions
18
...ring/edgechain-app/src/main/java/com/edgechain/lib/configuration/domain/SecurityUUID.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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.edgechain.lib.configuration.domain; | ||
|
||
public class SecurityUUID { | ||
|
||
private String authKey; | ||
|
||
public SecurityUUID(String authKey) { | ||
this.authKey = authKey; | ||
} | ||
|
||
public String getAuthKey() { | ||
return authKey; | ||
} | ||
|
||
public void setAuthKey(String authKey) { | ||
this.authKey = authKey; | ||
} | ||
} |
Oops, something went wrong.