| 206 | } |
| 207 | |
| 208 | func getConfiguration(c *config.Config) (c_store *Config_store, err error) { |
| 209 | c_store = NewCS(c) |
| 210 | |
| 211 | // Admin |
| 212 | c_store.AddString(&ADMIN_EMAIL, "", "Admin", "email", "", "") |
| 213 | c_store.AddString(&ADMIN_USERS, "", "Admin", "users", "", "") |
| 214 | |
| 215 | // Access-Control |
| 216 | c_store.AddBool(&ANON_READ, true, "Anonymous", "read", "", "") |
| 217 | c_store.AddBool(&ANON_WRITE, true, "Anonymous", "write", "", "") |
| 218 | c_store.AddBool(&ANON_DELETE, true, "Anonymous", "delete", "", "") |
| 219 | |
| 220 | // Address |
| 221 | c_store.AddString(&API_IP, "0.0.0.0", "Address", "api-ip", "", "") |
| 222 | c_store.AddInt(&API_PORT, 7445, "Address", "api-port", "", "") |
| 223 | |
| 224 | // URLs |
| 225 | c_store.AddString(&API_URL, "http://localhost", "External", "api-url", "", "") |
| 226 | |
| 227 | // Auth |
| 228 | c_store.AddBool(&AUTH_BASIC, false, "Auth", "basic", "", "") |
| 229 | c_store.AddString(&AUTH_GLOBUS_TOKEN_URL, "", "Auth", "globus_token_url", "", "") |
| 230 | c_store.AddString(&AUTH_GLOBUS_PROFILE_URL, "", "Auth", "globus_profile_url", "", "") |
| 231 | c_store.AddString(&AUTH_OAUTH_URL_STR, "", "Auth", "oauth_urls", "", "") |
| 232 | c_store.AddString(&AUTH_OAUTH_BEARER_STR, "", "Auth", "oauth_bearers", "", "") |
| 233 | c_store.AddInt(&AUTH_CACHE_TIMEOUT, 60, "Auth", "cache_timeout", "", "") |
| 234 | |
| 235 | // Runtime |
| 236 | c_store.AddInt(&EXPIRE_WAIT, 60, "Runtime", "expire_wait", "", "") |
| 237 | c_store.AddString(&GOMAXPROCS, "", "Runtime", "GOMAXPROCS", "", "") |
| 238 | c_store.AddInt(&MAX_REVISIONS, 3, "Runtime", "max_revisions", "", "") |
| 239 | |
| 240 | // Log |
| 241 | c_store.AddBool(&LOG_PERF, false, "Log", "perf_log", "", "") |
| 242 | c_store.AddBool(&LOG_ROTATE, true, "Log", "rotate", "", "") |
| 243 | c_store.AddString(&LOG_OUTPUT, "both", "Log", "logoutput", "console, file or both", "") |
| 244 | c_store.AddBool(&LOG_TRACE, false, "Log", "trace", "", "") |
| 245 | |
| 246 | // Mongodb |
| 247 | c_store.AddString(&MONGODB_ATTRIBUTE_INDEXES, "", "Mongodb", "attribute_indexes", "", "") |
| 248 | c_store.AddString(&MONGODB_DATABASE, "ShockDB", "Mongodb", "database", "", "") |
| 249 | c_store.AddString(&MONGODB_HOSTS, "mongo", "Mongodb", "hosts", "", "") |
| 250 | c_store.AddString(&MONGODB_PASSWORD, "", "Mongodb", "password", "", "") |
| 251 | c_store.AddString(&MONGODB_USER, "", "Mongodb", "user", "", "") |
| 252 | |
| 253 | // parse Node-Indices |
| 254 | NODE_IDXS = map[string]idxOpts{} |
| 255 | nodeIdx, _ := c.Options("Node-Indices") |
| 256 | for _, opt := range nodeIdx { |
| 257 | val, _ := c.String("Node-Indices", opt) |
| 258 | opts := idxOpts{} |
| 259 | for _, parts := range strings.Split(val, ",") { |
| 260 | p := strings.Split(parts, ":") |
| 261 | if p[0] == "unique" { |
| 262 | if p[1] == "true" { |
| 263 | opts.unique = true |
| 264 | } else { |
| 265 | opts.unique = false |