Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
package com.springboot.blog;

import com.springboot.blog.entity.Role;
import com.springboot.blog.repository.RoleRepository;
import io.swagger.v3.oas.annotations.ExternalDocumentation;
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
import io.swagger.v3.oas.annotations.info.Contact;
import io.swagger.v3.oas.annotations.info.Info;
import io.swagger.v3.oas.annotations.info.License;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
Expand All @@ -31,7 +35,7 @@
url = "https://github.com/adiletkdev/springboot-blog-rest-api"
)
)
public class SpringbootBlogRestApiApplication {
public class SpringbootBlogRestApiApplication implements CommandLineRunner {

@Bean
public ModelMapper modelMapper() {
Expand All @@ -42,4 +46,17 @@ public static void main(String[] args) {
SpringApplication.run(SpringbootBlogRestApiApplication.class, args);
}

@Autowired
private RoleRepository roleRepository;

@Override
public void run(String... args) throws Exception {
Role adminRole = new Role();
adminRole.setName("ROLE_ADMIN");
roleRepository.save(adminRole);

Role userRole = new Role();
userRole.setName("ROLE_USER");
roleRepository.save(userRole);
}
}
9 changes: 9 additions & 0 deletions src/main/resources/application-dev.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
spring.datasource.url=jdbc:mysql://localhost:3306/myblog
spring.datasource.username=bestuser
spring.datasource.password=bestuser

# hibernate properties
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect

# hibernate ddl auto (create, create-drop, validate, update)
spring.jpa.hibernate.ddl-auto=update
11 changes: 11 additions & 0 deletions src/main/resources/application-prod.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
spring.datasource.url=jdbc:mysql://javajdk.cwhtfxb3sdkv.eu-north-1.rds.amazonaws.com:3306/myblog
spring.datasource.username=root
spring.datasource.password=javajdk123

# hibernate properties
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect

# hibernate ddl auto (create, create-drop, validate, update)
spring.jpa.hibernate.ddl-auto=update

server.port=5000
9 changes: 9 additions & 0 deletions src/main/resources/application-qa.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
spring.datasource.url=jdbc:mysql://localhost:3306/myblog
spring.datasource.username=bestuser
spring.datasource.password=bestuser

# hibernate properties
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect

# hibernate ddl auto (create, create-drop, validate, update)
spring.jpa.hibernate.ddl-auto=update
24 changes: 13 additions & 11 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
spring.datasource.url=jdbc:mysql://localhost:3306/myblog
spring.datasource.username=bestuser
spring.datasource.password=bestuser
# hibernate properties
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect
# hibernate ddl auto (create, create-drop, validate, update)
spring.jpa.hibernate.ddl-auto=update
#spring.security.user.name=user
#spring.security.user.password=user
#spring.security.user.roles=ADMIN
#spring.datasource.url=jdbc:mysql://localhost:3306/myblog
#spring.datasource.username=bestuser
#spring.datasource.password=bestuser
## hibernate properties
#spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect
## hibernate ddl auto (create, create-drop, validate, update)
#spring.jpa.hibernate.ddl-auto=update
##spring.security.user.name=user
##spring.security.user.password=user
##spring.security.user.roles=ADMIN

#secret javaproject
app.jwt-secret=ce02356f9917223373f26bb97ef5c3e4fafef9cde898bf9cf960e7d08e74ffef
app-jwt-expiration-milliseconds=604800000
app-jwt-expiration-milliseconds=604800000

spring.profiles.active=prod