Something went wrong. Try again.
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334import Configurationimport EffemAppViewimport Foundationimport Hummingbirdimport Logging
@mainstruct App { static func main() async { // One line per event on standard output, where the host collects logs. LoggingSystem.bootstrap(StreamLogHandler.standardOutput)
do { // Configuration is read, in order, from the command line, the // environment, a `.env` file in the working directory and defaults. let reader = try await ConfigReader(providers: [ CommandLineArgumentsProvider(), EnvironmentVariablesProvider(secretsSpecifier: .specific(AppViewServer.secretEnvironmentVariables)), EnvironmentVariablesProvider(environmentFilePath: ".env", allowMissing: true, secretsSpecifier: .specific(AppViewServer.secretEnvironmentVariables)), ]) let app = try await AppViewServer.build(reader: reader) try await app.runService() } catch { // A bad setting or an unreachable database ends up here. Say why in // one line and leave with a failure status, rather than trapping // with "Error raised at top level" and a crash report. Logger(label: "effem-appview").critical("the service could not start or stopped with an error", metadata: [ "error": "\(AppViewServer.describe(error))", ]) exit(EXIT_FAILURE) } }}