This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const MovieList = ({listId}: {listId: string}) => { | |
const [moviesList, setMoviesList] = useState<Movie[]>(); | |
const { loading: loadingMovies } = useFetch<Movie[], unknown>( | |
request(`api/movies/${listId}`), | |
[listId], | |
{ | |
when: () => listId != undefined, | |
onSuccessEffect: setMoviesList | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
DependencyList, | |
useEffect, | |
useCallback, | |
useState, | |
useMemo, | |
} from "react"; | |
import * as R from "ramda"; | |
import { attemptP, fork, FutureInstance } from "fluture"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using nClam; | |
using System; | |
using Microsoft.Azure.WebJobs; | |
using Microsoft.Azure.WebJobs.Extensions.EventGrid; | |
using Microsoft.Extensions.Logging; | |
using Azure.Storage.Blobs; | |
using System.IO; | |
using System.Threading.Tasks; | |
using Newtonsoft.Json.Linq; | |
using System.Linq; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ##### RUN AV ON FILE ##### | |
log.LogInformation("Download completed. Connecting to AV server {ClamAVServerUrl}:{ClamAVServerPort}... ", ClamAVServerUrl, ClamAVServerPort); | |
var clam = new ClamClient(ClamAVServerUrl, ClamAVServerPort); | |
bool isConnected = await clam.PingAsync(); | |
var version = await clam.GetVersionAsync(); | |
if (!isConnected) throw new Exception("AV server connection could not be established."); | |
log.LogInformation("Connection ok: {IsConnected}. AV server reports version: {ServerVersion}", isConnected, version); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ##### READ EVENT GRID EVENT FROM REQUEST ##### | |
log.LogInformation("Begin handling request. {EventGridEvent}", eventGridEvent.Data); | |
if (!TryGetEventData<string>(eventGridEvent, CREATED_EVENT_URL, out var url)) | |
{ | |
log.LogError("EventData could not be parsed. UrlFound check failed."); | |
return; | |
} | |
// ##### READ FILE NAME AND STORAGE ACCOUNT CONTAINER NAME FROM EVENT GRID EVENT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[FunctionName("RunAvOnFileUploaded")] | |
public static async Task Run([EventGridTrigger] Microsoft.Azure.EventGrid.Models.EventGridEvent eventGridEvent, ILogger log) | |
{ | |
// *** | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Startup | |
{ | |
public void ConfigureServices(IServiceCollection services) | |
{ | |
services.AddMvc(); | |
} | |
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) | |
{ | |
app.UseStatusCodePagesWithReExecute("/StatusCode/{0}"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public string DbConnectionString => Environment.GetEnvironmentVariable("DB_CONNECTIONSTRING") | |
?? _configuration.GetConnectionString("DB_CONNECTIONSTRING") | |
?? "DevelopmentEnvironmentConnectionString"; | |
public string BasicAuthUserName => Environment.GetEnvironmentVariable("BASICAUTH_USERNAME") | |
?? _configuration["BasicAuth:Username"] | |
?? "admin"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"Staging": { | |
"commandName": "Project", | |
"launchBrowser": true, | |
"launchUrl": "swagger", | |
"applicationUrl": "http://localhost:5005", | |
"environmentVariables": { | |
"ASPNETCORE_ENVIRONMENT": "Staging", | |
"API_USERNAME": "admin", | |
"API_PASSWORD": "test123", | |
"DB_CONNECTIONSTRING": "Data Source=SERVER;Initial Catalog=DBName;User ID=username;Password=password;" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ExecutableFixture : IDisposable | |
{ | |
private Process _process; | |
private bool _isDevelopment; | |
public ExecutableFixture() | |
{ | |
var executableRootPath = "../../../../APIProject/bin/Debug/netcoreapp1.1/"; | |
_isDevelopment = File.Exists($"{executableRootPath}APIProject.dll"); |
NewerOlder