Skip to content

Commit b7462b8

Browse files
authored
Make Lambda.env() -> String? public (#61)
1 parent 9310ad8 commit b7462b8

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

Sources/AWSLambdaRuntimeCore/Lambda.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,14 @@ public enum Lambda {
6262
self.run(factory: factory)
6363
}
6464

65+
/// Utility to access/read environment variables
66+
public static func env(_ name: String) -> String? {
67+
guard let value = getenv(name) else {
68+
return nil
69+
}
70+
return String(cString: value)
71+
}
72+
6573
// for testing and internal use
6674
@discardableResult
6775
internal static func run(configuration: Configuration = .init(), handler: Handler) -> Result<Int, Error> {

Sources/AWSLambdaRuntimeCore/Utils.swift

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,6 @@ internal enum AmazonHeaders {
3636
static let invokedFunctionARN = "Lambda-Runtime-Invoked-Function-Arn"
3737
}
3838

39-
/// Utility to read environment variables
40-
internal func env(_ name: String) -> String? {
41-
guard let value = getenv(name) else {
42-
return nil
43-
}
44-
return String(cString: value)
45-
}
46-
4739
/// Helper function to trap signals
4840
internal func trap(signal sig: Signal, handler: @escaping (Signal) -> Void) -> DispatchSourceSignal {
4941
let signalSource = DispatchSource.makeSignalSource(signal: sig.rawValue, queue: DispatchQueue.global())

0 commit comments

Comments
 (0)