@implementation MDConfigManager{
    NSString* _filepath;
}

+ (instancetype)sharedInstance{
    static MDConfigManager *sharedInstance = nil;
    if (!sharedInstance){
        sharedInstance = [[MDConfigManager alloc] init];
    }
    return sharedInstance;
}

- (BOOL)isActive{
    _filepath = [[NSBundle mainBundle] pathForResource:CONFIG_FILE_NAME ofType:@"plist"];
    if(_filepath == nil){
        return NO;
    }
    return YES;
}

- (NSDictionary*) readConfigByKey:(NSString*) key{
    if([self isActive]){
        NSDictionary* contentDict = [NSDictionary dictionaryWithContentsOfFile:_filepath];
        if([contentDict.allKeys containsObject:key]){
            return contentDict[key];
        }else{
            return nil;
        }
    }else{
        return nil;
    }
}

@end
