package edu.oregonstate.mist.locations

import com.fasterxml.jackson.annotation.JsonProperty
import edu.oregonstate.mist.api.Credentials
import io.dropwizard.Configuration

import javax.validation.Valid
import javax.validation.constraints.NotNull
import io.dropwizard.db.DataSourceFactory

class LocationConfiguration extends Configuration {
    @JsonProperty('authentication')
    @NotNull
    @Valid
    List<Credentials> credentialsList
//
//    @Valid
//    @NotNull
//    @JsonProperty("database")
//    DataSourceFactory database = new DataSourceFactory()

    @JsonProperty('locations')
    @NotNull
    @Valid
    Map<String, String> locationsConfiguration

//    @JsonProperty("database")
//    public DataSourceFactory getDataSourceFactory() {
//        database
//    }
//
//    @JsonProperty("database")
//    public void setDataSourceFactory(DataSourceFactory dataSourceFactory) {
//        this.database = dataSourceFactory
//    }
}

package edu.oregonstate.mist.locations

import com.fasterxml.jackson.annotation.JsonProperty
import edu.oregonstate.mist.api.Credentials
import io.dropwizard.Configuration

import javax.validation.Valid
import javax.validation.constraints.NotNull
import io.dropwizard.db.DataSourceFactory

class LocationConfiguration extends Configuration {
    @JsonProperty('authentication')
    @NotNull
    @Valid
    List<Credentials> credentialsList

    //@Valid
    //@NotNull
    @JsonProperty("database")
    DataSourceFactory database = new DataSourceFactory()

    @JsonProperty('locations')
    @NotNull
    @Valid
    Map<String, String> locationsConfiguration

//    @JsonProperty("database")
//    public DataSourceFactory getDataSourceFactory() {
//        database
//    }
//
//    @JsonProperty("database")
//    public void setDataSourceFactory(DataSourceFactory dataSourceFactory) {
//        this.database = dataSourceFactory
//    }
}

Add the "database" config option back
Add the "database" config option back

Re-add the "database" config option so that old config files still work,
but make it optional, so newer config files also still work. Everybody
wins!
