package be.naaturel.boardmateapi.configurations;

import be.naaturel.boardmateapi.common.helpers.Logger;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Arrays;

@Configuration
public class StartupLogger {

    @Bean
    public String log() {
        try {
            String hash = BuildHasher.get();
            Logger.displayInfo("Hash for this version " + hash);
            return hash;
        } catch (Exception e) {
            throw new RuntimeException("Unable to generate a hash for this version\n" + Arrays.toString(e.getStackTrace()));
        }
    }
}
