Compare commits

...

4 commits

7 changed files with 85 additions and 10 deletions

View file

@ -1,3 +1,7 @@
# Database section
DB_USER=
DB_PASSWORD=
DB_PASSWORD=
# Minio S3 section
MINIO_ACCESS_KEY=
MINIO_SECRET_KEY=

View file

@ -2,10 +2,6 @@
<configuration default="false" name="start server" type="Application" factoryName="Application">
<option name="ALTERNATIVE_JRE_PATH" value="17" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
<envs>
<env name="DB_USER" value="postgres" />
<env name="DB_PASSWORD" value="postgres" />
</envs>
<option name="MAIN_CLASS_NAME" value="com.mixel.docusphere.DocuSphereApplication" />
<module name="DocuSphere.server.main" />
<method v="2">

View file

@ -24,6 +24,12 @@ dependencies {
implementation 'org.springframework.security:spring-security-crypto:6.3.3'
implementation 'org.bouncycastle:bcprov-jdk15on:1.70'
// Dotenv manager
implementation 'io.github.cdimascio:java-dotenv:5.2.2'
// Minio S3 Storage
implementation 'io.minio:minio:8.5.12'
runtimeOnly 'org.postgresql:postgresql'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'

View file

@ -0,0 +1,28 @@
package com.mixel.docusphere.config;
import io.github.cdimascio.dotenv.Dotenv;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import javax.sql.DataSource;
import org.springframework.boot.jdbc.DataSourceBuilder;
@Configuration
public class DataSourceConfig {
@Bean
@Primary
public DataSource dataSource() {
// Load environment variables from .env file
Dotenv dotenv = Dotenv.configure().load();
// Build the DataSource using Dotenv values
DataSourceBuilder<?> dataSourceBuilder = DataSourceBuilder.create()
.driverClassName("org.postgresql.Driver")
.url(dotenv.get("DB_URL"))
.username(dotenv.get("DB_USER"))
.password(dotenv.get("DB_PASSWORD"));
return dataSourceBuilder.build();
}
}

View file

@ -0,0 +1,33 @@
package com.mixel.docusphere.config;
import io.github.cdimascio.dotenv.Dotenv;
import jakarta.annotation.PostConstruct;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class DotenvConfig {
private final Dotenv dotenv;
public DotenvConfig() {
this.dotenv = Dotenv.configure()
.directory("../") // Adjust path as needed
.filename(".env")
.ignoreIfMissing()
.load();
}
@PostConstruct
public void init() {
dotenv.entries().forEach(entry ->
System.setProperty(entry.getKey(), entry.getValue())
);
System.out.println("Dotenv variables loaded");
}
@Bean
public Dotenv dotenv() {
return dotenv;
}
}

View file

@ -4,9 +4,6 @@ spring:
datasource:
driver-class-name: org.postgresql.Driver
url: jdbc:postgresql://localhost:5432/docusphere
username: ${DB_USER}
password: ${DB_PASSWORD}
jpa:
hibernate:
@ -20,3 +17,10 @@ logging:
level:
org.hibernate.SQL: debug
org.hibernate.type.descriptor.sql.BasicBinder: trace
org.springframework.core.env: debug
minio:
endpoint: "http://localhost:9000" # Your MinIO endpoint URL
access-key: ${MINIO_ACCESS_KEY} # Environment variable for the access key
secret-key: ${MINIO_SECRET_KEY} # Environment variable for the secret key
bucket-name: docusphere # The bucket name you want to use

View file

@ -2,7 +2,6 @@
import { ref } from "vue";
const showSearch = ref(false);
const userProfileActions = ref(false);
</script>
<template>
@ -22,7 +21,12 @@ const userProfileActions = ref(false);
<!---------------->
<!-- Search Bar -->
<!---------------->
<v-btn icon="mdi-magnify" @click="showSearch = !showSearch"> </v-btn>
<v-btn
class="mr-1"
icon="mdi-magnify"
@click="showSearch = !showSearch"
>
</v-btn>
<v-slide-x-reverse-transition hide-on-leave>
<v-responsive v-show="showSearch" min-width="20vw">