Skip to content

Instantly share code, notes, and snippets.

View fragaLY's full-sized avatar
💭
"...ain't no such things as halfway crooks." Mobb Deep

Vadzim Kavalkou fragaLY

💭
"...ain't no such things as halfway crooks." Mobb Deep
View GitHub Profile
@fragaLY
fragaLY / build.gradle.kts
Last active June 29, 2021 13:06
Setting up Jib using build.gradle.kts
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.util.parseSpaceSeparatedArgs
plugins {
application
id("org.springframework.boot") version "2.5.2"
id("io.spring.dependency-management") version "1.0.11.RELEASE"
kotlin("jvm") version "1.5.20"
kotlin("plugin.spring") version "1.5.20"
id("com.google.cloud.tools.jib") version "3.1.1"
@fragaLY
fragaLY / NotificationPostFilter.kt
Last active July 2, 2021 11:53
Spring Boot Gateway Setup [ for 'prod' profile - config server in use ]
@Component
class NotificationPostFilter : AbstractGatewayFilterFactory<NotificationPostFilter.Config>(Config::class.java) {
private val logger = LoggerFactory.getLogger(javaClass)
class Config
override fun apply(config: Config?): GatewayFilter {
return GatewayFilter { exchange: ServerWebExchange?, chain: GatewayFilterChain ->
chain.filter(exchange)
@fragaLY
fragaLY / ConfigServerApplication.kt
Last active July 2, 2021 11:49
Spring Boot Config Server Setup
@EnableConfigServer
@SpringBootApplication
class ConfigServerApplication
fun main(args: Array<String>) {
runApplication<ConfigServerApplication>(*args)
}
@fragaLY
fragaLY / Consumer.kt
Last active July 2, 2021 12:04
Spring Boot Kafka EOS Support [ for 'prod' profile - config server in use ]
@Component
class Consumer(private val mapper: ObjectMapper, private val notificationService: NotificationService) {
private val logger = LoggerFactory.getLogger(javaClass)
@KafkaListener(groupId = "\${spring.kafka.consumer.group-id}", topics = ["notification-event"])
fun onMessage(@Payload payload: String, meta: ConsumerRecordMetadata, acknowledgment: Acknowledgment) {
val event = mapper.readValue(payload, NotificationEvent::class.java)
val notification = when (event.type) {
EventType.CREATE_NOTIFICATION -> notificationService.create(event.notification)
@fragaLY
fragaLY / application.yml
Last active July 2, 2021 12:04
Spring Boot Zipkin Kafka Integration [ for 'prod' profile - config server in use ]
spring:
application:
name: producer-service
cloud:
config:
enabled: false
main:
lazy-initialization: false
web-application-type: servlet
banner-mode: off
@fragaLY
fragaLY / .gitlab-ci.yml
Created October 8, 2021 11:40
Gitlab CI/CD example
---
stages:
- semver
- build
- test
- linting
- version-push
- docker
- security
- deploy
@fragaLY
fragaLY / ci.yml
Created October 8, 2021 12:02
Github Actions with Telegram Notification Example
name: ci
on:
push:
branches:
- main
- develop
- 'feature/**'
jobs:
@fragaLY
fragaLY / application.yml
Created December 6, 2021 08:40
The hapi fhir jpa server configuration
server:
port: 8080
shutdown: graceful
undertow:
threads:
worker: 24
io: 3
error:
whitelabel:
enabled: false
@fragaLY
fragaLY / datastore.js
Last active December 16, 2021 11:44
Google Cloud Datastore and Node.js example
'use strict';
const config = require('../config');
const Datastore = require("@google-cloud/datastore");
const datastore = Datastore({
projectId: config.get('GCLOUD_PROJECT')
});
const kind = 'Question';
@fragaLY
fragaLY / cloudstorage.js
Created December 16, 2021 12:03
Storing Image and Video Files in Cloud Storage
'use strict';
const Storage = require('@google-cloud/storage');
const config = require('../config');
const GCLOUD_BUCKET = config.get('GCLOUD_BUCKET');
const storage = Storage({
projectId: config.get('GCLOUD_PROJECT')
});